Skip to content
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

server: Optimize sending for SubscriptionSink::pipe_from_stream #901

Merged
merged 1 commit into from
Oct 13, 2022

Conversation

lexnv
Copy link
Contributor

@lexnv lexnv commented Oct 12, 2022

The SubscriptionSink::send contains the logic for:

  • accepting the subscription if not previously accepted
  • building and sending the response to the client

While this offers ergonomic benefits for the server users not needing
to handle the accepting of the subscription, this function is exercised
during SubscriptionSink::pipe_from_stream.

The SubscriptionSink::pipe_from_stream first accepts the subscription
if previously not accepted, then it submits to the client side each element
from the provided stream. The sending of elements can be optimized
to not accept the subscription because it was priorly accepted.

This PR creates an inner private helper function for sending the response
to the client without accepting the subscription.

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@lexnv lexnv requested a review from a team as a code owner October 12, 2022 15:55
@lexnv lexnv self-assigned this Oct 12, 2022
@jsdw jsdw requested a review from a team October 13, 2022 07:48
@lexnv lexnv merged commit b99e01e into master Oct 13, 2022
@lexnv lexnv deleted the lexnv/optimize_send branch October 13, 2022 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants