]> code.delx.au - offlineimap/commitdiff
Quick synchronizations (for 'quick' > 0) are now performed between full synchronizati...
authorMichal Vitecek <fuf@mageo.cz>
Fri, 10 Jul 2009 09:27:31 +0000 (11:27 +0200)
committerJohn Goerzen <jgoerzen@complete.org>
Sun, 12 Jul 2009 13:54:18 +0000 (08:54 -0500)
Hello John,

 The attached patch makes quick synchronization work again (according to
 the documentation), so there are <quick> quick synchronizations
 performed between full synchronizations.

 Thanks,
        Michal

offlineimap/accounts.py

index 55fba9bf75165cbd5700461f68fe002eba0e86ec..f0f19e4c8712baa2bbdbafac547844997d30c9e0 100644 (file)
@@ -109,6 +109,7 @@ class Account(CustomConfig.ConfigHelperMixin):
         self.localeval = config.getlocaleval()
         self.ui = UIBase.getglobalui()
         self.refreshperiod = self.getconffloat('autorefresh', 0.0)
+        self.quickrefreshcount = self.getconfint('quick', 0)
         self.quicknum = 0
         if self.refreshperiod == 0.0:
             self.refreshperiod = None
@@ -144,8 +145,11 @@ class Account(CustomConfig.ConfigHelperMixin):
 
         for item in kaobjs:
             item.startkeepalive()
-        
-        refreshperiod = int(self.refreshperiod * 60)
+
+        sleeptime = int(self.refreshperiod * 60)
+        if (self.quickrefreshcount > 0):
+            sleeptime = int(sleeptime / self.quickrefreshcount)
+
 #         try:
 #             sleepresult = siglistener.get_nowait()
 #             # retrieved signal before sleep started
@@ -153,8 +157,8 @@ class Account(CustomConfig.ConfigHelperMixin):
 #                 # catching signal 1 here means folders were cleared before signal was posted
 #                 pass
 #         except Empty:
-#             sleepresult = self.ui.sleep(refreshperiod, siglistener)
-        sleepresult = self.ui.sleep(refreshperiod, siglistener)
+#             sleepresult = self.ui.sleep(sleeptime, siglistener)
+        sleepresult = self.ui.sleep(sleeptime, siglistener)
         if sleepresult == 1:
             self.quicknum = 0