Skip to content

Commit 446bd1e

Browse files
committed
pull out of option in select
1 parent 912e376 commit 446bd1e

File tree

1 file changed

+18
-22
lines changed

1 file changed

+18
-22
lines changed

upstairs/src/notify.rs

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -148,26 +148,22 @@ async fn notify_task_nexus(
148148
.unwrap();
149149

150150
loop {
151-
let r = {
152-
if stored_notification.is_some() {
153-
stored_notification.take()
154-
} else {
155-
tokio::select! {
156-
biased;
157-
158-
i = rx_high.recv() => i.map(|message| Notification {
159-
message,
160-
qos: NotifyQos::High,
161-
retries: 0,
162-
}),
163-
164-
i = rx_low.recv() => i.map(|message| Notification {
165-
message,
166-
qos: NotifyQos::Low,
167-
retries: 0,
168-
}),
169-
}
170-
}
151+
let r = tokio::select! {
152+
biased;
153+
154+
Some(n) = async { stored_notification.take() } => Some(n),
155+
156+
i = rx_high.recv() => i.map(|message| Notification {
157+
message,
158+
qos: NotifyQos::High,
159+
retries: 0,
160+
}),
161+
162+
i = rx_low.recv() => i.map(|message| Notification {
163+
message,
164+
qos: NotifyQos::Low,
165+
retries: 0,
166+
}),
171167
};
172168

173169
let Some(Notification {
@@ -208,8 +204,8 @@ async fn notify_task_nexus(
208204
DownstairsClientStoppedReason::ConnectionTimeout
209205
}
210206
ClientRunResult::ConnectionFailed(_) => {
211-
// skip this notification, it's too noisy during connection
212-
// retries
207+
// skip this notification, it's too noisy during
208+
// connection retries
213209
//DownstairsClientStoppedReason::ConnectionFailed
214210
continue;
215211
}

0 commit comments

Comments
 (0)