<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2015-03-23 18:05 GMT+01:00 Nicolas Sebrecht <span dir="ltr"><<a href="mailto:nicolas.s-dev@laposte.net" target="_blank">nicolas.s-dev@laposte.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Can't we do something like that?<br>
<br>
--- >8 ---<br>
Subject: [PATCH] WIP: avoid Queue.get() too much to avoid battery sucking<br>
From: Nicolas Sebrecht <<a href="mailto:nicolas.s-dev@laposte.net">nicolas.s-dev@laposte.net</a>><br><span class=""></span></blockquote><div><br></div><div>On my previous email I've found keepalive timer to be the worst offender.<br></div><div>It's not that bad that when sleeping for a couple seconds too many wakeups arise, but being actively waiting during the whole 29 minutes between restablishing the IDLE connection is pretty much killing my battery life.<br><br></div><div>I've never done any python threading programming and don't know much about offlineimap threading architecture, so I don't know if this is possible, but could this simple patch solve the issue?<br><br>diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py<br>index f0b2248..21c3c5c 100644<br>--- a/offlineimap/imapserver.py<br>+++ b/offlineimap/imapserver.py<br>@@ -596,7 +596,7 @@ class IMAPServer:<br> threads.append(idler)<br> <br> self.ui.debug('imap', 'keepalive: waiting for timeout')<br>- event.wait(timeout)<br>+ time.sleep(timeout)<br> self.ui.debug('imap', 'keepalive: after wait')<br> <br> for idler in threads:<br><br></div></div><br>-- <br><div class="gmail_signature">Álvaro Gámez Machado<br></div>
</div></div>