Rework keepalive to use time.sleep() instead of event.wait()
This should improve power-management abilities some more The catch is that we can't wait any longer for the kathread to terminate. We were waiting for this in some cases. This is probably not a big deal. fixes deb#434074 fixes #66
This commit is contained in:
@ -171,8 +171,8 @@ class BaseRepository(CustomConfig.ConfigHelperMixin):
|
||||
"""The default implementation will do nothing."""
|
||||
pass
|
||||
|
||||
def stopkeepalive(self, abrupt = 0):
|
||||
"""Stop keep alive. If abrupt is 1, stop it but don't bother waiting
|
||||
def stopkeepalive(self):
|
||||
"""Stop keep alive, but don't bother waiting
|
||||
for the threads to terminate."""
|
||||
pass
|
||||
|
||||
|
@ -57,14 +57,12 @@ class IMAPRepository(BaseRepository):
|
||||
self.kathread.setDaemon(1)
|
||||
self.kathread.start()
|
||||
|
||||
def stopkeepalive(self, abrupt = 0):
|
||||
def stopkeepalive(self):
|
||||
if not hasattr(self, 'kaevent'):
|
||||
# Keepalive is not active.
|
||||
return
|
||||
|
||||
self.kaevent.set()
|
||||
if not abrupt:
|
||||
self.kathread.join()
|
||||
del self.kathread
|
||||
del self.kaevent
|
||||
|
||||
|
Reference in New Issue
Block a user