mirror of
https://git.code.sf.net/p/archivemail/code
synced 2025-03-12 15:52:50 +00:00
don't delete more than a certain number of messages at a time. The max command len is limited. Fixes bug 942403 (Archiving large IMAP folders fails)
This commit is contained in:
parent
07aca153f6
commit
adfb7a63d7
1 changed files with 8 additions and 3 deletions
|
@ -1279,8 +1279,13 @@ def _archive_imap(mailbox_name, final_archive_name):
|
||||||
if archive:
|
if archive:
|
||||||
archive.close()
|
archive.close()
|
||||||
archive.finalise()
|
archive.finalise()
|
||||||
vprint("Deleting messages")
|
# do not delete more than a certain number of messages at a time, because the
|
||||||
imap_srv.store(string.join(message_list, ','),
|
# command length is limited. This avoids that servers terminate the connection with
|
||||||
|
# EOF or TCP RST.
|
||||||
|
vprint("Deleting %s messages" % len(message_list))
|
||||||
|
max_delete = 100
|
||||||
|
for i in range(0, len(message_list), max_delete):
|
||||||
|
imap_srv.store(string.join(message_list[i:i+max_delete], ','),
|
||||||
'+FLAGS.SILENT', '\\Deleted')
|
'+FLAGS.SILENT', '\\Deleted')
|
||||||
imap_srv.close()
|
imap_srv.close()
|
||||||
imap_srv.logout()
|
imap_srv.logout()
|
||||||
|
|
Loading…
Add table
Reference in a new issue