summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-09-06 16:33:24 +0000
committerFatih Acet <acetfatih@gmail.com>2016-09-06 16:33:24 +0000
commitaf66fefc376db8b7e392ed249105ba6ce597e025 (patch)
tree547d73dada2d1b95fe39ac351a6a54b2ebab7a97
parentaa152e4a275434949ade20d20b5dc30d23d1bba9 (diff)
parent924141fbfacaed336f05c06b7c02c3349b2cd2c7 (diff)
downloadgitlab-ce-af66fefc376db8b7e392ed249105ba6ce597e025.tar.gz
Merge branch 'improve-vuejs-resource-interceptor' into 'master'
Reduce intermittent spec failures by making VueJS resource interceptor decrement outstanding resource counts when HTTP response is received Before the count would be reduced 500 ms after a DOM update tick, which could cause race conditions since the `DatabaseCleaner` could run in the middle of a Rails controller handling the response. Partial fix to #21197 and other intermittent spec failures. See merge request !6224
-rw-r--r--app/assets/javascripts/boards/vue_resource_interceptor.js.es69
1 files changed, 3 insertions, 6 deletions
diff --git a/app/assets/javascripts/boards/vue_resource_interceptor.js.es6 b/app/assets/javascripts/boards/vue_resource_interceptor.js.es6
index f9f9f7999d4..b5ff3a81ed5 100644
--- a/app/assets/javascripts/boards/vue_resource_interceptor.js.es6
+++ b/app/assets/javascripts/boards/vue_resource_interceptor.js.es6
@@ -1,10 +1,7 @@
-Vue.http.interceptors.push((request, next) => {
+Vue.http.interceptors.push((request, next) => {
Vue.activeResources = Vue.activeResources ? Vue.activeResources + 1 : 1;
- Vue.nextTick(() => {
- setTimeout(() => {
- Vue.activeResources--;
- }, 500);
+ next(function (response) {
+ Vue.activeResources--;
});
- next();
});