ConradIrwin / em-imap

An event machine based IMAP client
MIT License
69 stars 31 forks source link

(Nearly) Simultaneous emails aren't caught #19

Open JConwayAWT opened 10 years ago

JConwayAWT commented 10 years ago

I've spent a while trying to debug this and also asking around, and eventually a few people came to the conclusion that it may be an issue inside em-imap. Apologies if I'm wrong, however.

In the example posted here: http://stackoverflow.com/questions/21104289/eventmachine-not-catching-nearly-simultaneous-events/21107426 , I'm trying to catch emails as they come in and do some operation on them. This works well when separated by a few seconds, but when emails come in nearly simultaneously, only one of that group of emails will be processed. This is true even when the processing is very minimal, such as at the bottom of that post, where the program only puts the subject line.

This may be an issue with em-imap. Or it may just be that I'm new to em and using it incorrectly. If that's the issue, just let me know and I apologize for the error.

ConradIrwin commented 10 years ago

Hey @JConwayAWT. The current implementation of wait_for_new_emails doesn't find emails that appear while you're processing.

This is somewhat annoying to fix as IMAP is pretty complicated... We might be able to get a long way there by issuing a NOOP before the IDLE and seeing whether there are any new IDs. I'd love a pull request if you're up to it :).