From d55be49e6466d3b94c06e487149c7f912fa725d8 Mon Sep 17 00:00:00 2001 From: noraiz-anwar Date: Mon, 25 Feb 2019 18:50:25 +0500 Subject: [PATCH] add back off for failing recurrent requests --- lms/static/js/instructor_dashboard/util.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lms/static/js/instructor_dashboard/util.js b/lms/static/js/instructor_dashboard/util.js index 6712d6702c..3104c055e3 100644 --- a/lms/static/js/instructor_dashboard/util.js +++ b/lms/static/js/instructor_dashboard/util.js @@ -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($('

').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(); } }); };