add back off for failing recurrent requests

This commit is contained in:
noraiz-anwar
2019-02-25 18:50:25 +05:00
committed by Noraiz Anwar
parent 11e1631919
commit d55be49e64

View File

@@ -327,6 +327,7 @@
this.ms = ms;
this.fn = fn;
this.intervalID = null;
this.failedTries = 0;
}
intervalManager.prototype.start = function() {
@@ -344,6 +345,15 @@
return this.intervalID;
};
intervalManager.prototype.failed_retry_threshold = 5;
intervalManager.prototype.backOff = function() {
this.failedTries++;
if (this.failedTries >= this.failed_retry_threshold) {
this.stop();
}
};
return intervalManager;
}());
@@ -388,6 +398,9 @@
ths.$no_tasks_message.append($('<p>').text(gettext('No tasks currently running.')));
return ths.$no_tasks_message.show();
}
},
error: function() {
ths.task_poller.backOff();
}
});
};
@@ -464,6 +477,9 @@
} else {
return false;
}
},
error: function() {
ths.downloads_poller.backOff();
}
});
};