Skip to content

Conversation

@link2xt
Copy link
Collaborator

@link2xt link2xt commented Nov 6, 2025

For multiple transports we will need to run
multiple IMAP clients in parallel.
UID validity change detected by one IMAP client
should not result in UID resync
for another IMAP client.

For multiple transports we will need to run
multiple IMAP clients in parallel.
UID validity change detected by one IMAP client
should not result in UID resync
for another IMAP client.
@link2xt link2xt force-pushed the link2xt/uid-resync-imap branch from 8e1e909 to ee2582b Compare November 6, 2025 01:05
@link2xt link2xt mentioned this pull request Nov 6, 2025
16 tasks
@link2xt link2xt marked this pull request as ready for review November 6, 2025 02:14
@link2xt link2xt requested a review from Copilot November 6, 2025 19:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the IMAP UID resync request mechanism from an atomic boolean flag to an async channel-based approach. The refactoring provides better decoupling by moving the resync request handling from the global Context into the IMAP module.

Key changes:

  • Replaces AtomicBool with async_channel::bounded(1) for resync requests
  • Removes Context::schedule_resync() method and migrates callers to use channel
  • Removes unreachable address change detection code in configure.rs

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/context.rs Removes atomic bool resync_request field and schedule_resync() method
src/imap.rs Adds bounded async channel (sender/receiver) for resync requests
src/imap/session.rs Adds resync_request_sender field to Session struct
src/imap/select_folder.rs Replaces schedule_resync() calls with try_send() on channel
src/scheduler.rs Updates resync request check from atomic swap to try_recv() on channel
src/configure.rs Removes unreachable address change resync scheduling logic
Comments suppressed due to low confidence (1)

src/configure.rs:571

  • [nitpick] The removed address change detection code (lines 568-576 in the old version) was unreachable because add_transport_inner() already prevents address changes at line 134-137. However, this removal is correct and simplifies the code by eliminating dead code. Consider adding a comment explaining that address changes are prevented earlier in the configuration flow if this is not obvious from context.
    let provider = configured_param.provider;
    configured_param
        .save_to_transports_table(ctx, param)
        .await?;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@link2xt link2xt merged commit 7fef812 into main Nov 6, 2025
35 checks passed
@link2xt link2xt deleted the link2xt/uid-resync-imap branch November 6, 2025 19:16
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.

3 participants