Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-08-23 12:31:17 +0300
committerDouwe Maan <douwe@selenight.nl>2017-08-23 12:31:17 +0300
commitfbe82e4cd9f4cda7264bb78eab9c5c55e6311518 (patch)
treede9444c1762fa43c336f595936878677aef8ce43 /app/assets/javascripts/lib
parent64820f9a6c17a348dc771a87618140a5c3c8874d (diff)
parent101d52b360a6a43f1633c5dd60b78e37bc8c4339 (diff)
Merge branch 'master' into issue-discussions-refactor
# Conflicts: # package.json
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r--app/assets/javascripts/lib/utils/common_utils.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js
index dce5e76ecee..b8bebe1894f 100644
--- a/app/assets/javascripts/lib/utils/common_utils.js
+++ b/app/assets/javascripts/lib/utils/common_utils.js
@@ -386,15 +386,15 @@
w.gl.utils.backOff = (fn, timeout = 60000) => {
const maxInterval = 32000;
let nextInterval = 2000;
-
- const startTime = Date.now();
+ let timeElapsed = 0;
return new Promise((resolve, reject) => {
const stop = arg => ((arg instanceof Error) ? reject(arg) : resolve(arg));
const next = () => {
- if (Date.now() - startTime < timeout) {
- setTimeout(fn.bind(null, next, stop), nextInterval);
+ if (timeElapsed < timeout) {
+ setTimeout(() => fn(next, stop), nextInterval);
+ timeElapsed += nextInterval;
nextInterval = Math.min(nextInterval + nextInterval, maxInterval);
} else {
reject(new Error('BACKOFF_TIMEOUT'));