summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Walker <mike@barrucadu.co.uk>2014-05-05 19:30:59 +0100
committerMichael Walker <mike@barrucadu.co.uk>2014-05-05 19:33:57 +0100
commit97cfec836bcb60a3f781ea459100a9610aac6f2a (patch)
treeb77a26b18226fa35d5d4bd44beaf047f42f3d311
parent91a3016d27ab3644d677333d0130366f3b0d68a6 (diff)
Add a maximum reload delay
-rw-r--r--js/auto-reload.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/js/auto-reload.js b/js/auto-reload.js
index 2cbdd7e8..3159bfd1 100644
--- a/js/auto-reload.js
+++ b/js/auto-reload.js
@@ -36,6 +36,9 @@ $(document).ready(function(){
poll_interval_delay = poll_interval_mindelay_bottom;
+ // Don't take longer than this to reload.
+ var poll_interval_maxdelay = 600000;
+
// Upon scrolling to the bottom, reload very quickly.
var poll_interval_shortdelay = 100;
@@ -97,6 +100,11 @@ $(document).ready(function(){
// If there are no new posts, double the delay. Otherwise set it to the min.
if(new_posts == 0) {
poll_interval_delay *= 2;
+
+ // Don't increase the delay beyond the maximum
+ if(poll_interval_delay > poll_interval_maxdelay) {
+ poll_interval_delay = poll_interval_maxdelay;
+ }
} else {
poll_interval_delay = end_of_page
? poll_interval_mindelay_bottom