summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-09-06 07:41:32 -0400
committerStan Hu <stanhu@gmail.com>2016-09-06 07:51:17 -0400
commit924141fbfacaed336f05c06b7c02c3349b2cd2c7 (patch)
tree937745a4a27b3fee1b9dbebedc5b921abe381443
parent2aaab34b67eb2a6593780eda33d501a715ef0c5f (diff)
downloadgitlab-ce-improve-vuejs-resource-interceptor.tar.gz
Reduce intermittent spec failures by making VueJS resource interceptorimprove-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.
-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();
});