Improve alarm init#122
Open
syyyr wants to merge 8 commits into
Open
Conversation
25dc4b6 to
90739ba
Compare
264fdaf to
17f727c
Compare
Code coverage report for 5dc11c2Coverage difference❌ Code coverage worsened.
Overall coverageClick to expand
HTML reports |
j4r0u53k
reviewed
May 28, 2026
Comment on lines
+725
to
+735
| let mut mntchng_next = if !state.mntchng_subscribers.is_empty() { | ||
| state.mntchng_subscribers.next().left_future() | ||
| } else { | ||
| futures::future::pending().right_future() | ||
| }.fuse(); | ||
|
|
||
| let mut subscribers_next = if !state.subscribers.is_empty() { | ||
| state.subscribers.next().left_future() | ||
| } else { | ||
| futures::future::pending().right_future() | ||
| }.fuse(); |
Collaborator
There was a problem hiding this comment.
tokio::select! and branch guards can be used instead:
mntchng_frame = state.mntchng_subscribers.next(), if !state.mntchng_subscribers.is_empty() => {
Comment on lines
+363
to
+366
| match old_subscribers.remove(&key) { | ||
| Some(subscriber) => { | ||
| subscribers.insert(key, subscriber); | ||
| None |
Collaborator
There was a problem hiding this comment.
Doing these side effects in a filter_map seems a bit odd to me.
What about?
for (path, signal) in subscriptions {
let key = format!("{path}:*:{signal}");
if let Some(subscriber) = old_subscribers.remove(&key) {
// Keep existing subscriber
subscribers.insert(key, subscriber);
} else {
// Queue up creation for missing subscriber
new_sub_futures.push(async move {
let subscriber = subscribe(client_cmd_tx, &path, &signal).await;
(key, subscriber)
});
}
}
// Await all new subscriptions concurrently and merge them in
for (key, subscriber) in join_all(new_sub_futures).await {
subscribers.insert(key, subscriber);
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.