Skip to content

Commit 28c89ce

Browse files
add comments
1 parent 1262c0c commit 28c89ce

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

crates/core/src/client/client_connection.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ impl ClientConnectionSender {
160160
}
161161

162162
pub fn is_cancelled(&self) -> bool {
163+
// We check this when processing subscription updates to exit early for dropped clients.
164+
// We use `Acquire` here because we prioritize early exit over cheaper loads.
163165
self.cancelled.load(Ordering::Acquire)
164166
}
165167

@@ -180,7 +182,9 @@ impl ClientConnectionSender {
180182
// the channel, so forcibly kick the client
181183
tracing::warn!(identity = %self.id.identity, connection_id = %self.id.connection_id, "client channel capacity exceeded");
182184
self.abort_handle.abort();
183-
self.cancelled.store(true, Relaxed);
185+
// We check this when processing subscription updates to exit early for dropped clients.
186+
// We use `Release` here because we prioritize early exit over cheaper stores.
187+
self.cancelled.store(true, Ordering::Release);
184188
return Err(ClientSendError::Cancelled);
185189
}
186190
Err(mpsc::error::TrySendError::Closed(_)) => return Err(ClientSendError::Disconnected),

crates/core/src/subscription/module_subscription_manager.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,8 @@ struct SendWorkerClient {
12781278

12791279
impl SendWorkerClient {
12801280
fn is_dropped(&self) -> bool {
1281+
// We check this when processing subscription updates to exit early for dropped clients.
1282+
// We use `Acquire` here because we prioritize early exit over cheaper loads.
12811283
self.dropped.load(Ordering::Acquire)
12821284
}
12831285

0 commit comments

Comments
 (0)