mirror of
https://github.com/chatmail/core.git
synced 2026-05-15 12:56:30 +03:00
Add folder name to IMAP IDLE interrupt logs
This commit is contained in:
@@ -54,10 +54,10 @@ impl Imap {
|
|||||||
Interrupt(InterruptInfo),
|
Interrupt(InterruptInfo),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let folder_name = watch_folder.as_deref().unwrap_or("None");
|
||||||
info!(
|
info!(
|
||||||
context,
|
context,
|
||||||
"{}: Idle entering wait-on-remote state",
|
"{}: Idle entering wait-on-remote state", folder_name
|
||||||
watch_folder.as_deref().unwrap_or("None")
|
|
||||||
);
|
);
|
||||||
let fut = idle_wait.map(|ev| ev.map(Event::IdleResponse)).race(async {
|
let fut = idle_wait.map(|ev| ev.map(Event::IdleResponse)).race(async {
|
||||||
let info = self.idle_interrupt.recv().await;
|
let info = self.idle_interrupt.recv().await;
|
||||||
@@ -70,26 +70,35 @@ impl Imap {
|
|||||||
|
|
||||||
match fut.await {
|
match fut.await {
|
||||||
Ok(Event::IdleResponse(IdleResponse::NewData(x))) => {
|
Ok(Event::IdleResponse(IdleResponse::NewData(x))) => {
|
||||||
info!(context, "Idle has NewData {:?}", x);
|
info!(context, "{}: Idle has NewData {:?}", folder_name, x);
|
||||||
}
|
}
|
||||||
Ok(Event::IdleResponse(IdleResponse::Timeout)) => {
|
Ok(Event::IdleResponse(IdleResponse::Timeout)) => {
|
||||||
info!(context, "Idle-wait timeout or interruption");
|
info!(
|
||||||
|
context,
|
||||||
|
"{}: Idle-wait timeout or interruption", folder_name
|
||||||
|
);
|
||||||
}
|
}
|
||||||
Ok(Event::IdleResponse(IdleResponse::ManualInterrupt)) => {
|
Ok(Event::IdleResponse(IdleResponse::ManualInterrupt)) => {
|
||||||
info!(context, "Idle wait was interrupted");
|
info!(
|
||||||
|
context,
|
||||||
|
"{}: Idle wait was interrupted manually", folder_name
|
||||||
|
);
|
||||||
}
|
}
|
||||||
Ok(Event::Interrupt(i)) => {
|
Ok(Event::Interrupt(i)) => {
|
||||||
|
info!(
|
||||||
|
context,
|
||||||
|
"{}: Idle wait was interrupted: {:?}", folder_name, &i
|
||||||
|
);
|
||||||
info = i;
|
info = i;
|
||||||
info!(context, "Idle wait was interrupted");
|
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
warn!(context, "Idle wait errored: {:?}", err);
|
warn!(context, "{}: Idle wait errored: {:?}", folder_name, err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let session = tokio::time::timeout(Duration::from_secs(15), handle.done())
|
let session = tokio::time::timeout(Duration::from_secs(15), handle.done())
|
||||||
.await?
|
.await?
|
||||||
.context("IMAP IDLE protocol timed out")?;
|
.with_context(|| format!("{}: IMAP IDLE protocol timed out", folder_name))?;
|
||||||
self.session = Some(Session { inner: session });
|
self.session = Some(Session { inner: session });
|
||||||
} else {
|
} else {
|
||||||
warn!(context, "Attempted to idle without a session");
|
warn!(context, "Attempted to idle without a session");
|
||||||
|
|||||||
Reference in New Issue
Block a user