From 2c2f3a291d33591190af4cefbcd2225c11e86712 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Tue, 6 Aug 2013 01:37:10 +0200 Subject: refactor recurring fetch --- src/leap/mail/imap/service/imap.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/leap/mail/imap/service') diff --git a/src/leap/mail/imap/service/imap.py b/src/leap/mail/imap/service/imap.py index 6a8d37f..9e331b6 100644 --- a/src/leap/mail/imap/service/imap.py +++ b/src/leap/mail/imap/service/imap.py @@ -20,9 +20,7 @@ Imap service initialization import logging logger = logging.getLogger(__name__) -#from twisted.application import internet, service from twisted.internet.protocol import ServerFactory -from twisted.internet.task import LoopingCall from twisted.mail import imap4 from twisted.python import log @@ -36,8 +34,8 @@ from leap.soledad import Soledad IMAP_PORT = 9930 # The default port in which imap service will run -#INCOMING_CHECK_PERIOD = 10 -INCOMING_CHECK_PERIOD = 5 +# INCOMING_CHECK_PERIOD = 5 +INCOMING_CHECK_PERIOD = 60 # The period between succesive checks of the incoming mail # queue (in seconds) @@ -148,12 +146,10 @@ def run_service(*args, **kwargs): fetcher = LeapIncomingMail( keymanager, soledad, - factory.theAccount) + factory.theAccount, + check_period) - lc = LoopingCall(fetcher.fetch) - lc.start(check_period) + fetcher.start_loop() logger.debug("IMAP4 Server is RUNNING in port %s" % (port,)) - - # XXX maybe return both fetcher and lc?? - return lc + return fetcher -- cgit v1.2.3