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

fix: emit events more reliable when starting and stopping io #5097 #5101

Merged
merged 3 commits into from
Jan 12, 2024

Conversation

Septias
Copy link
Collaborator

@Septias Septias commented Dec 11, 2023

Send EventType::ConnectivityChanged when using the context methods start_io and stop_io.

close #5097

Send `EventType::ConnectivityChanged` when using the context methods `start_io` and `stop_io`
@Septias Septias marked this pull request as ready for review December 11, 2023 14:49
@Septias Septias requested a review from link2xt December 11, 2023 14:50
src/scheduler.rs Outdated Show resolved Hide resolved
@link2xt
Copy link
Collaborator

link2xt commented Dec 11, 2023

Needs a test that 1. Stopping i/o emits an event and connectivity status is actually disconnected/offline when the event arrives. 2. Starting i/o back emits event and connectivity status is at least connecting or so.

This is for displaying online status in account manager, if connectivity status does not actually change or changes after emitting the event, emitting events is not useful.

@Septias
Copy link
Collaborator Author

Septias commented Dec 14, 2023

For me it looks like the test you mentioned in the comment (test_connectivity) actually does cover the cases you pointed out @link2xt

@link2xt
Copy link
Collaborator

link2xt commented Dec 14, 2023

For me it looks like the test you mentioned in the comment (test_connectivity) actually does cover the cases you pointed out

This test passes even without the fix currently. Maybe need to run consume_events() before calling start_io() and stop_io().

@adbenitez
Copy link
Member

I am using this, works like a charm, would be nice to finish the test thing and merge it

@Septias
Copy link
Collaborator Author

Septias commented Jan 11, 2024

Even with consume_events the test runs without a problem.
The logic for sending ConnectivityChanged is spread more or less randomly across the core, most occurrences in ConnectivityStore and all its methods which are executed in SmtpConnectionState and ImapConnectionState. As soon as any connections of these is established or errored out, the event is emitted. Startup should thus be pretty reliable, but teardown not so much. The tests suggest differently though...
I suggest that we merge this without a specific test as it should improve reliability of the event.

@Septias Septias changed the title fix: emit events when starting and stopping io fix: emit events when starting and stopping io #5097 Jan 12, 2024
@Septias Septias changed the title fix: emit events when starting and stopping io #5097 fix: emit events more reliable when starting and stopping io #5097 Jan 12, 2024
@Septias Septias merged commit de7ac2a into main Jan 12, 2024
38 checks passed
@Septias Septias deleted the sk/fix_event_io_start_stop branch January 12, 2024 08:45
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.

stop_io() does not send "connectivity changed" event
5 participants