imap2maildir
imap2maildir copied to clipboard
Turbo mode skipping emails it shouldn't skip
I have some folders on my IMAP servers where imap2maildir tubo mode is eager to turbo new emails. It is very annoying. I have to do non-turbo mode on those, and it takes a long time to run.
$ imap2maildir -c imap2md.conf -v --create -d archive/main -r INBOX/main -s ALL
Opening sqlite3 database 'archive/main/.imap2maildir.sqlite'
Synchronizing 833 messages from gwmail.emea.novell.com:INBOX/main to /home/aaptel/mails/archive/main...
TURBO MODE ENGAGED!
Populating hash cache...
Hash cache: 2224 hashes
Populating uid cache...
Uid cache: 1405 uids
FINISHED: Turboed 833, handled 0, copied 0 (0 bytes), last UID was 0
I've added a few print statements here and there (simpleimap.py Summaries)
def Summaries(self, search='ALL'):
""" Summaries
"""
if self.__turbo:
self.__parent.select(self.__folder, readonly=True)
for u in self.Uids(search=search):
if not self.__turbo(u):
print(' not TURBO u= '+repr(u))
try:
summ = self.__parent.get_summary_by_uid(u)
if summ:
yield summ
except Exception:
logging.exception("Couldn't retrieve uid %s", u)
continue
else:
print(' TURBO u= '+repr(u)) ### print 833 times here
# long hangtimes can suck
self.__keepaliver()
self.__turbocounter += 1
else:
for s in self.__parent.get_summaries_by_folder(self.__folder, self.__charset, search):
yield s
And in imap2maildir check_message()
elif uid:
print("u=%s uid"%uid) ### prints 833 times here
if str(uid) in seencache.uids:
mailfile = seencache.uids[str(uid)]
else:
c.execute('select mailfile from seenmessages where uid=?', (uid,))
row = c.fetchone()
if row:
log.debug("Cache miss on uid %s" % uid)
mailfile = row[0]
else:
return False
I'm not sure what is happening but it is super annoying >:(
Forgot to say, exactly one new email should have been fetched here.
the new email UID is checked in both turbo and non-turbo, but only fetched in non-turbo.