[Pkg-mozext-commits] [sage-extension] 07/20: pause between checking feeds, fixes #133

David Prévot taffit at moszumanska.debian.org
Sat Feb 13 01:36:53 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository sage-extension.

commit a6f731f47baedc8d57b33dd293fc1261cca69db4
Author: Peter Andrews <petea at jhu.edu>
Date:   Sat Aug 1 16:21:45 2015 -0700

    pause between checking feeds, fixes #133
---
 src/modules/SageUpdateChecker.jsm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/modules/SageUpdateChecker.jsm b/src/modules/SageUpdateChecker.jsm
index 9381805..334a923 100644
--- a/src/modules/SageUpdateChecker.jsm
+++ b/src/modules/SageUpdateChecker.jsm
@@ -54,6 +54,8 @@ loader.loadSubScript("chrome://sage/content/commonfunc.js");
 const DELAY = 60 * 60 * 1000; // One hour between each check
 const INITIAL_CHECK = 5 * 1000; // Delay the first check to avoid impacting startup performance
 const FEED_CHECK_TIMEOUT = 10 * 1000; // Wait up to ten seconds for a feed to load
+const DELAY_BETWEEN_FEEDS = 1 * 1000; // Pause between checking feeds to avoid monopolizing the main thread
+const DELAY_BETWEEN_FEEDS_INTERACTIVE = 0.1 * 1000; // Interactive checking delay 
 
 var SageUpdateChecker = {
 
@@ -223,6 +225,7 @@ var SageUpdateChecker = {
       SageMetrics.event("Noninteractive", "Checking Feeds", { value: feedCount });
       if (feedCount > 0) {
         this.checking = true;
+        this.interactive = !nonInteraction;
         this.check();
       }
     }).bind(this), 1000);
@@ -370,7 +373,9 @@ var SageUpdateChecker = {
         this.checking = false;
         this.notifyObservers("sage-nowRefreshing", "");
       } else {
-        this.check();
+        setTimeout(function() {
+          this.check();
+        }.bind(this), this.interactive ? DELAY_BETWEEN_FEEDS_INTERACTIVE : DELAY_BETWEEN_FEEDS);
       }
     }    
   }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/sage-extension.git



More information about the Pkg-mozext-commits mailing list