Try to handle rate limiting
This commit is contained in:
parent
683fd75700
commit
ce2d4defde
3 changed files with 9 additions and 3 deletions
|
|
@ -1313,8 +1313,14 @@ TimelineModel::redactEvent(const QString &id, const QString &reason)
|
|||
http::client()->redact_event(
|
||||
room_id_.toStdString(),
|
||||
id.toStdString(),
|
||||
[this, id](const mtx::responses::EventId &, mtx::http::RequestErr err) {
|
||||
[this, id, reason](const mtx::responses::EventId &, mtx::http::RequestErr err) {
|
||||
if (err) {
|
||||
if (err->status_code == 429 && err->matrix_error.retry_after.count() != 0) {
|
||||
QTimer::singleShot(err->matrix_error.retry_after, this, [this, id, reason]() {
|
||||
this->redactEvent(id, reason);
|
||||
});
|
||||
return;
|
||||
}
|
||||
emit redactionFailed(tr("Message redaction failed: %1")
|
||||
.arg(QString::fromStdString(err->matrix_error.error)));
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue