1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Tweak RETRY_BACKOFF_RATELIMIT to take browser-request's CORS failures into account.

This commit is contained in:
Kegan Dougal
2015-11-05 15:48:48 +00:00
parent 455ce26741
commit 21e56d2f53

View File

@@ -133,6 +133,12 @@ MatrixScheduler.RETRY_BACKOFF_RATELIMIT = function(event, attempts, err) {
// client error; no amount of retrying with save you now. // client error; no amount of retrying with save you now.
return -1; return -1;
} }
// we ship with browser-request which returns { cors: rejected } when trying
// with no connection, so if we match that, give up since they have no conn.
if (err.cors === "rejected") {
return -1;
}
if (err.name === "M_LIMIT_EXCEEDED") { if (err.name === "M_LIMIT_EXCEEDED") {
var waitTime = err.data.retry_after_ms; var waitTime = err.data.retry_after_ms;
if (waitTime) { if (waitTime) {