summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-09-23 15:47:11 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2022-09-23 15:47:25 +0200
commitce2d4defdecf376eca9f8579672779dfdf093d21 (patch)
treeec3152fd8c63a890df5d5d79579f00a6e423c11d /src
parentMore granular automoc (diff)
downloadnheko-ce2d4defdecf376eca9f8579672779dfdf093d21.tar.xz
Try to handle rate limiting
Diffstat (limited to 'src')
-rw-r--r--src/timeline/TimelineModel.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp

index 1ddef7b7..36e21e53 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp
@@ -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;