1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-16 18:21:59 +03:00

Do not retry requests which 40[0/1/3]. Set 'errcode' on MatrixErrors

This commit is contained in:
Kegan Dougal
2015-07-29 10:30:07 +01:00
parent 7f9c88e53f
commit 54a5c38b66
2 changed files with 7 additions and 1 deletions

View File

@@ -129,6 +129,10 @@ MatrixScheduler.prototype.queueEvent = function(event) {
* @see module:scheduler~retryAlgorithm
*/
MatrixScheduler.RETRY_BACKOFF_RATELIMIT = function(event, attempts, err) {
if (err.httpStatus === 400 || err.httpStatus === 403 || err.httpStatus === 401) {
// client error; no amount of retrying with save you now.
return -1;
}
if (err.name === "M_LIMIT_EXCEEDED") {
var waitTime = err.data.retry_after_ms;
if (waitTime) {