fix imap fetch loop and watch folders

This commit is contained in:
dignifiedquire
2020-03-21 16:26:27 +01:00
parent 1846f20f6e
commit 8a7eaba668
4 changed files with 146 additions and 151 deletions

View File

@@ -269,8 +269,12 @@ async fn start(args: Vec<String>) -> Result<(), failure::Error> {
let ctx = context.clone();
std::thread::spawn(move || loop {
if let Ok(event) = ctx.get_next_event() {
receive_event(event);
if ctx.has_next_event() {
if let Ok(event) = ctx.get_next_event() {
receive_event(event);
}
} else {
std::thread::sleep(std::time::Duration::from_millis(50));
}
});