mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
PERF: Add exponential backoff for /presence/update
errors (#22864)
We already handled 429 rate limit errors correctly. This commit adds backoff logic to other types of error to avoid requests being retried every second.
This commit is contained in:
parent
0f1479e896
commit
27cdd724ce
@ -562,6 +562,11 @@ export default class PresenceService extends Service {
|
|||||||
const waitSeconds = e.jqXHR.responseJSON?.extras?.wait_seconds || 10;
|
const waitSeconds = e.jqXHR.responseJSON?.extras?.wait_seconds || 10;
|
||||||
this._presenceDebounceMs = waitSeconds * 1000;
|
this._presenceDebounceMs = waitSeconds * 1000;
|
||||||
} else {
|
} else {
|
||||||
|
// Other error, exponential backoff capped at 30 seconds
|
||||||
|
this._presenceDebounceMs = Math.min(
|
||||||
|
this._presenceDebounceMs * 2,
|
||||||
|
PRESENCE_INTERVAL_S * 1000
|
||||||
|
);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user