Increase the retry timeout value by 10 seconds at each retry, up to 120 seconds. Reset on succesful connection.

This commit is contained in:
Nicolas Stepien 2011-12-14 11:01:17 +01:00
parent f07da722c7
commit 0e7d56b002
2 changed files with 12 additions and 6 deletions

View File

@ -1996,6 +1996,7 @@
}
}
$.add(d.body, dialog);
updater.retryCoef = 10;
return updater.lastModified = 0;
},
cb: {
@ -2036,6 +2037,7 @@
Favicon.update();
return;
}
updater.retryCoef = 10;
updater.timer.textContent = '-' + conf['Interval'];
/*
Status Code 304: Not modified
@ -2055,7 +2057,7 @@
innerHTML: this.responseText
});
if ($('title', body).textContent === '4chan - Banned') {
updater.count.textContent = 'banned';
updater.count.textContent = 'Banned';
updater.count.className = 'error';
return;
}
@ -2087,14 +2089,15 @@
n = 1 + Number(updater.timer.textContent);
if (n === 0) {
return updater.update();
} else if (n === 10) {
} else if (n === updater.retryCoef) {
updater.retryCoef += 10 * (updater.retryCoef < 120);
return updater.retry();
} else {
return updater.timer.textContent = n;
}
},
retry: function() {
updater.count.textContent = 'retry';
updater.count.textContent = 'Retry';
updater.count.className = '';
return updater.update();
},

View File

@ -1593,6 +1593,7 @@ updater =
$.add d.body, dialog
updater.retryCoef = 10
updater.lastModified = 0
cb:
@ -1625,6 +1626,7 @@ updater =
Favicon.update()
return
updater.retryCoef = 10
updater.timer.textContent = '-' + conf['Interval']
###
@ -1645,7 +1647,7 @@ updater =
#this only works on Chrome because of cross origin policy
if $('title', body).textContent is '4chan - Banned'
updater.count.textContent = 'banned'
updater.count.textContent = 'Banned'
updater.count.className = 'error'
return
@ -1675,13 +1677,14 @@ updater =
if n is 0
updater.update()
else if n is 10
else if n is updater.retryCoef
updater.retryCoef += 10 * (updater.retryCoef < 120)
updater.retry()
else
updater.timer.textContent = n
retry: ->
updater.count.textContent = 'retry'
updater.count.textContent = 'Retry'
updater.count.className = ''
updater.update()