The IMAP transport protocol mailbox fetch works like this:
- Get all message IDs (even ones marked \Deleted.)
- For each message ID:
a. fetch the email
b. call the receive signal
c. mark it \Deleted
- expunge all \Deleted.
We are experiencing the same message being downloaded multiple times, in situations where our polling mechanism crashes in the middle of looping (in our case, due to many messages taking too long and Celery sigkilling the process).
This seems unnecessary. I am no IMAP expert, but from reviewing the IMAP RFC, it seems we could either move the expunge into the loop so it happens after each \Deleted mark, or else change the _get_all_message_ids from:
response, message_ids = self.server.uid('search', None, 'ALL')
to
response, message_ids = self.server.uid('search', None, 'UNDELETED')
Or both... thoughts?
The IMAP transport protocol mailbox fetch works like this:
a. fetch the email
b. call the receive signal
c. mark it \Deleted
We are experiencing the same message being downloaded multiple times, in situations where our polling mechanism crashes in the middle of looping (in our case, due to many messages taking too long and Celery sigkilling the process).
This seems unnecessary. I am no IMAP expert, but from reviewing the IMAP RFC, it seems we could either move the expunge into the loop so it happens after each \Deleted mark, or else change the
_get_all_message_idsfrom:response, message_ids = self.server.uid('search', None, 'ALL')to
response, message_ids = self.server.uid('search', None, 'UNDELETED')Or both... thoughts?