Use Retry-After header for rate limited requests in purge room

This commit is contained in:
N-Pex 2025-09-17 15:47:20 +02:00
parent 145160240a
commit 609e4a97c2

View file

@ -876,11 +876,7 @@ export default {
const withRetry = (codeBlock) => {
return codeBlock().catch((error) => {
if (error && error.errcode == "M_LIMIT_EXCEEDED") {
var retry = 1000;
if (error.data) {
const retryIn = error.data.retry_after_ms;
retry = Math.max(retry, retryIn ? retryIn : 0);
}
const retry = error.getRetryAfterMs() ?? 1000;
console.log("Rate limited, retry in", retry);
return sleep(retry).then(() => withRetry(codeBlock));
} else {