mirror of
https://github.com/chatmail/core.git
synced 2026-04-02 05:22:14 +03:00
fix a problem where IDLE would run but miss messages
This commit is contained in:
@@ -52,6 +52,14 @@ impl Imap {
|
||||
let mut info = Default::default();
|
||||
|
||||
if let Some(session) = self.session.take() {
|
||||
// if we have unsolicited responses we directly return
|
||||
if let Ok(res) = session.unsolicited_responses.try_recv() {
|
||||
warn!(context, "skip idle, got unsolicited response {:?}", res);
|
||||
self.session = Some(session);
|
||||
return Ok(info);
|
||||
}
|
||||
|
||||
|
||||
let mut handle = session.idle();
|
||||
if let Err(err) = handle.init().await {
|
||||
return Err(Error::IdleProtocolFailed(err));
|
||||
@@ -75,8 +83,8 @@ impl Imap {
|
||||
});
|
||||
|
||||
match fut.await {
|
||||
Ok(Event::IdleResponse(IdleResponse::NewData(_))) => {
|
||||
info!(context, "Idle has NewData");
|
||||
Ok(Event::IdleResponse(IdleResponse::NewData(x))) => {
|
||||
info!(context, "Idle has NewData {:?}", x);
|
||||
}
|
||||
Ok(Event::IdleResponse(IdleResponse::Timeout)) => {
|
||||
info!(context, "Idle-wait timeout or interruption");
|
||||
|
||||
Reference in New Issue
Block a user