scan_folders() bugfix: Don't exclude watched folders from being set as sent/spam folder

This does fix a bug and it makes the tests pass, but I'm not sure why it
makes the tests pass; maybe there is a race condition that made the
tests fail and my commit just leads to another timing.
This commit is contained in:
Hocuri
2021-02-14 10:55:51 +01:00
parent 6e7d4959a7
commit 48c58a711e

View File

@@ -44,15 +44,6 @@ impl Imap {
};
let foldername = folder.name();
if watched_folders.contains(&foldername.to_string()) {
info!(
context,
"Not scanning folder {} as it is watched anyway", foldername
);
continue;
}
info!(context, "Scanning folder: {}", foldername);
let folder_meaning = get_folder_meaning(&folder);
let folder_name_meaning = get_folder_meaning_by_name(foldername);
@@ -70,8 +61,17 @@ impl Imap {
spam_folder = Some(folder.name().to_string());
}
if let Err(e) = self.fetch_new_messages(context, foldername, false).await {
warn!(context, "Can't fetch new msgs in scanned folder: {:#}", e);
if watched_folders.contains(&foldername.to_string()) {
info!(
context,
"Not scanning folder {} as it is watched anyway", foldername
);
} else {
info!(context, "Scanning folder: {}", foldername);
if let Err(e) = self.fetch_new_messages(context, foldername, false).await {
warn!(context, "Can't fetch new msgs in scanned folder: {:#}", e);
}
}
}