Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMAP refactoring #4977

Merged
merged 4 commits into from
Nov 10, 2023
Merged

IMAP refactoring #4977

merged 4 commits into from
Nov 10, 2023

Conversation

link2xt
Copy link
Collaborator

@link2xt link2xt commented Nov 10, 2023

All but the last commit moved out of #4974

@link2xt link2xt enabled auto-merge (rebase) November 10, 2023 16:37
@link2xt link2xt disabled auto-merge November 10, 2023 16:37
@link2xt link2xt merged commit 56b4bb0 into main Nov 10, 2023
24 checks passed
@link2xt link2xt deleted the link2xt/refactor-imap branch November 10, 2023 16:38
Comment on lines -563 to -577
// Fetch the watched folder again in case scanning other folder moved messages
// there.
//
// In most cases this will select the watched folder and return because there are
// no new messages. We want to select the watched folder anyway before going IDLE
// there, so this does not take additional protocol round-trip.
if let Err(err) = connection
.fetch_move_delete(ctx, &watch_folder, folder_meaning)
.await
.context("fetch_move_delete after scan_folders")
{
connection.trigger_reconnect(ctx);
warn!(ctx, "{:#}", err);
return InterruptInfo::new(false);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@link2xt Did you remove this by accident, or don't we need it anymore?

Don't we need to fetch Inbox again after scanning? (IIUC this is about the Spam folder, because I can't think of another folder from which we would want to move messages to the Inbox).

Or is it just that the added complexity isn't worth the speedup? (IIUC this was about performance, not correctness, because when going IDLE the server would notify us about new messages)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not actually merged, the last commit caused the tests to break and I removed it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still on the main branch:

match connection.scan_folders(ctx).await.context("scan_folders") {
Err(err) => {
// Don't reconnect, if there is a problem with the connection we will realize this when IDLEing
// but maybe just one folder can't be selected or something
warn!(ctx, "{:#}", err);
}
Ok(true) => {
// Fetch the watched folder again in case scanning other folder moved messages
// there.
//
// In most cases this will select the watched folder and return because there are
// no new messages. We want to select the watched folder anyway before going IDLE
// there, so this does not take additional protocol round-trip.
if let Err(err) = connection
.fetch_move_delete(ctx, &watch_folder, folder_meaning)
.await
.context("fetch_move_delete after scan_folders")
{
connection.trigger_reconnect(ctx);
warn!(ctx, "{:#}", err);
return;
}
}
Ok(false) => {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants