summaryrefslogtreecommitdiff
path: root/web-ui/app/js/mail_list/ui/mail_syncing_progress_bar.js
diff options
context:
space:
mode:
Diffstat (limited to 'web-ui/app/js/mail_list/ui/mail_syncing_progress_bar.js')
-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);
});
}
}