Skip to content

Commit 9944ae0

Browse files
committed
RUST-856 Fix race between server selection and server monitoring (#460)
1 parent 339d5b8 commit 9944ae0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/sdam/monitor.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,15 @@ impl HeartbeatMonitor {
122122
None => break,
123123
};
124124

125+
// subscribe to check requests before performing the check in case one comes in
126+
// after the check completes
127+
let mut topology_check_requests_subscriber =
128+
topology.subscribe_to_topology_check_requests();
129+
125130
if self.check_server(&topology, &server).await {
126131
topology.notify_topology_changed();
127132
}
128133

129-
let mut topology_check_requests_subscriber =
130-
topology.subscribe_to_topology_check_requests();
131-
132134
// drop strong reference to topology before going back to sleep in case it drops off
133135
// in between checks.
134136
drop(topology);

0 commit comments

Comments
 (0)