Skip to content

Commit 8adcd5a

Browse files
authored
Subscription requests now take priority over notifications (#7031)
1 parent f5c84e3 commit 8adcd5a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ Release channels have their own copy of this changelog:
1515
<a name="edge-channel"></a>
1616
## 3.0.0 - Unreleased
1717

18+
### RPC
19+
20+
#### Changes
21+
* The subscription server now prioritizes processing received messages before sending out responses. This ensures that new subscription requests and time-sensitive messages like `PING` opcodes take priority over notifications.
22+
1823
### Validator
1924

2025
#### Breaking

rpc/src/rpc_pubsub_service.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,12 @@ async fn handle_connection(
401401
pin!(receive_future);
402402
loop {
403403
select! {
404+
biased; // See [prioritization] note below.
405+
406+
// [prioritization]
407+
// This block must come FIRST in the `select!` macro. This prioritizes
408+
// processing received messages over sending messages. This ensures the timely
409+
// processing of new subscriptions and time-sensitive opcodes like `PING`.
404410
result = &mut receive_future => match result {
405411
Ok(_) => break,
406412
Err(soketto::connection::Error::Closed) => return Ok(()),

0 commit comments

Comments
 (0)