I have a bunch of code that does IMAP commands “search, idle, done, search, idle, done, search, ...”.
Is it possible that some messages arrive between search and idle commands and, thus, will only be received by that code after the idle return / timeout?
EDIT1: I tried it with GMail: tested with sleep 60 between the message-processing and IDLE, and IDLE didn't return before timeout even though there were messages; to make sure I didn't miss an event from IDLE, I did a clientside send/recv dump and tried an additional read() before the sending of IDLE after the sleep(); while sending test messaged during the sleep().
EDIT2: Using two connections, one for getting the mail (using 'SEARCH') and another for using IDLE to get instant 'there are new messages' events, avoids the race condition, but someone claims there are some problems with that.