You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The IdleManager.watch(folder) method returns immediately after queuing the folder for IDLE monitoring, before the IDLE state is actually established. This makes it impossible to know when the IMAP IDLE connection is ready to receive messages.
Debug logs show this sequence:
DEBUG IMAP: IdleManager.watch startIdle succeeded for imaps://%[email protected]/INBOX // watch() returns here
DEBUG IMAP: IdleManager selected 0 channels
DEBUG IMAP: IdleManager adding imaps://%[email protected]/INBOX to selector
DEBUG IMAP: IdleManager waiting... // IDLE is actually ready here.
It is easy to make the mistake of thinking IDLE is ready when it isn't as watch() succeeds prematurely.
We understand the reasoning on why watch() exits prematurely - it is due to the executor running in parallel however we must be able to wait for IDLE to succeed before continuing.
Expected Behavior
One of these options:
watch() should wait until IDLE is fully established
Add a new method like watchAndWait() that blocks until IDLE is ready
Expose a way to query/listen for the IDLE ready state
Use Case
When setting up IMAP IDLE monitoring, applications need to know when the connection is actually ready to receive messages. Currently there's no clean way to detect this without resorting to implementation details or log parsing.
Mail server:
It is an issue with the angus-mail itself and not the mail server.
Protocol being used: imap
Mail service URL: gmail.com
Additional context
Currently, it appears the only way to wait for an IDLE state to be ready is via "hacks".
The text was updated successfully, but these errors were encountered:
Current Behavior
The
IdleManager.watch(folder)
method returns immediately after queuing the folder for IDLE monitoring, before the IDLE state is actually established. This makes it impossible to know when the IMAP IDLE connection is ready to receive messages.Debug logs show this sequence:
DEBUG IMAP: IdleManager.watch startIdle succeeded for imaps://%[email protected]/INBOX // watch() returns here
DEBUG IMAP: IdleManager selected 0 channels
DEBUG IMAP: IdleManager adding imaps://%[email protected]/INBOX to selector
DEBUG IMAP: IdleManager waiting... // IDLE is actually ready here.
It is easy to make the mistake of thinking IDLE is ready when it isn't as watch() succeeds prematurely.
We understand the reasoning on why watch() exits prematurely - it is due to the executor running in parallel however we must be able to wait for IDLE to succeed before continuing.
Expected Behavior
One of these options:
watch()
should wait until IDLE is fully establishedwatchAndWait()
that blocks until IDLE is readyUse Case
When setting up IMAP IDLE monitoring, applications need to know when the connection is actually ready to receive messages. Currently there's no clean way to detect this without resorting to implementation details or log parsing.
Mail server:
It is an issue with the angus-mail itself and not the mail server.
Additional context
Currently, it appears the only way to wait for an IDLE state to be ready is via "hacks".
The text was updated successfully, but these errors were encountered: