-
Notifications
You must be signed in to change notification settings - Fork 836
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rpc v2: submitAndWatch
replace old messages if it's lagging
#4901
Conversation
stream.filter_map(move |event| async move { handle_event(event) }).boxed(); | ||
|
||
// If the subscription is too slow older events will be overwritten. | ||
sink.pipe_from_stream(stream.boxed(), RingBuffer::new(3)).await; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the fix....
The CI pipeline was cancelled due to failure one of the required jobs. |
substrate/client/rpc-spec-v2/src/transaction/tests/transaction_tests.rs
Outdated
Show resolved
Hide resolved
.expect("Serialize infallible; qed") | ||
/// Send a message on the subscription. | ||
pub async fn send(&self, result: &impl Serialize) -> Result<(), DisconnectError> { | ||
self.0.send(self.to_sub_message(result)).await |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! This makes the api easier to use!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Nice job here 👍
…tech#4901) Close paritytech#3076 The fix is really just that older messages are replaced if the client can't keep up with the server instead. Because I wanted the same functionality as `pipe_from_stream` for both pending/subscription I added two wrapper types on-top of the types from jsonrpsee to make it nicer. I added a trait `Buffer` so I could still use pipe_from_stream but that abstraction is a little leaky but only to avoid adding an identical method/function with another strategy...
…paritytech#4901)" This reverts commit fc10887.
Close #3076
The fix is really just that older messages are replaced if the client can't keep up with the server instead.
Because I wanted the same functionality as
pipe_from_stream
for both pending/subscription I added two wrapper types on-top of the types from jsonrpsee to make it nicer.I added a trait
Buffer
so I could still use pipe_from_stream but that abstraction is a little leaky but only to avoid adding an identical method/function with another strategy...