Subscription requests now take priority over notifications#7031
Subscription requests now take priority over notifications#7031steveluscher merged 1 commit intoanza-xyz:masterfrom
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7031 +/- ##
=======================================
Coverage 83.2% 83.2%
=======================================
Files 853 853
Lines 374866 374866
=======================================
+ Hits 312054 312083 +29
+ Misses 62812 62783 -29 🚀 New features to boost your workflow:
|
lijunwangs
left a comment
There was a problem hiding this comment.
LGTM. Thanks for addressing this problem!
|
@steveluscher @joncinque , The issue is important for Chainlink's customers, can we consider back port this to the next release branch? |
|
Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis. |
(cherry picked from commit 8adcd5a) # Conflicts: # CHANGELOG.md
(cherry picked from commit 8adcd5a)
(cherry picked from commit 8adcd5a)
…kport of #7031) (#7092) * Subscription requests now take priority over notifications (#7031) (cherry picked from commit 8adcd5a) * Derp. This CHANGELOG already has an RPC section --------- Co-authored-by: Steven Luscher <steveluscher@users.noreply.github.com> Co-authored-by: Steven Luscher <steven.luscher@anza.xyz>
Problem
When there are a ton of notifications ready to send out over the RPC subscriptions server, they can end up starving the request processor. This means that time-sensitive requests like
PINGand new subscription requests don't get through.Summary of Changes
Always process waiting requests before sending out ready notifications.
Test plan
Add a sleep to let a ton of notifications pile up in the broadcast sender.
select! { result = &mut receive_future => match result { Ok(_) => { break; }, Err(soketto::connection::Error::Closed) => return Ok(()), Err(err) => return Err(err.into()), }, result = broadcast_receiver.recv() => { // In both possible error cases (closed or lagged) we disconnect the client. if let Some(json) = broadcast_handler.handle(result?)? { sender.send_text(&*json).await?; } + sleep(Duration::from_secs(6)).await; }, _ = &mut tripwire => { warn!("disconnecting websocket client: shutting down"); return Ok(()) }, }Send pings from the client.
Observe that they always get processed before the next notification gets sent.
Fixes #7022