summaryrefslogtreecommitdiff
path: root/web-ui
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-10-28 17:57:53 +0100
committerDuda Dornelles <ddornell@thoughtworks.com>2014-10-28 17:57:53 +0100
commit7ff1ecb1ef5faa95eeaf58576588929c8f536d4c (patch)
tree8ead4f58f54791fe8965b6de5a7cdc459e8c0ad3 /web-ui
parent377e03f7286b0f8f0e44186ced30a4092e1c0d4b (diff)
Cleaning callbacks for mail sync progress bar in case of an error (which means, probably, that the server is not up). if we dont do this it will add fire a ridiculous amount of requests the next time will start the server
Diffstat (limited to 'web-ui')
-rw-r--r--web-ui/app/js/mail_list/ui/mail_syncing_progress_bar.js19
1 files changed, 12 insertions, 7 deletions
diff --git a/web-ui/app/js/mail_list/ui/mail_syncing_progress_bar.js b/web-ui/app/js/mail_list/ui/mail_syncing_progress_bar.js
index 8ab6457e..9cdcc5dc 100644
--- a/web-ui/app/js/mail_list/ui/mail_syncing_progress_bar.js
+++ b/web-ui/app/js/mail_list/ui/mail_syncing_progress_bar.js
@@ -46,13 +46,18 @@ define(
};
this.doUpdate = function () {
- $.getJSON('/sync_info', function (data) {
- if (data.is_syncing) {
- this.updateProgressBar(data.count);
- } else {
+ $.getJSON('/sync_info')
+ .success(function (data) {
+ if (data.is_syncing) {
+ this.updateProgressBar(data.count);
+ } else {
+ this.resetProgressBar();
+ }
+ }.bind(this))
+ .error(function () {
+ clearInterval(this.attr.poolIntervalId);
this.resetProgressBar();
- }
- }.bind(this));
+ }.bind(this));
};
this.checkForMailSyncing = function () {
@@ -64,7 +69,7 @@ define(
this.after('initialize', function () {
this.checkForMailSyncing();
- setInterval(this.checkForMailSyncing.bind(this), 20000);
+ this.attr.poolIntervalId = setInterval(this.checkForMailSyncing.bind(this), 20000);
});
}
}