-
Notifications
You must be signed in to change notification settings - Fork 27
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
feat(ws): Add flow control to the tx history streamer #1126
Conversation
Bencher
Click to view all benchmark results
Bencher - Continuous Benchmarking View Public Perf Page Docs | Repo | Chat | Help |
219ada2
to
1163fe5
Compare
61054c1
to
670dd92
Compare
670dd92
to
c3a634b
Compare
c3a634b
to
b0ae958
Compare
b0ae958
to
6c9da5e
Compare
6c9da5e
to
303abdd
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1126 +/- ##
==========================================
- Coverage 84.61% 84.50% -0.11%
==========================================
Files 317 317
Lines 24150 24231 +81
Branches 3662 3680 +18
==========================================
+ Hits 20434 20477 +43
- Misses 3009 3050 +41
+ Partials 707 704 -3 ☔ View full report in Codecov by Sentry. |
f997cd2
to
a551bb4
Compare
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.
Looks good to me.
aa9eaca
to
a53373c
Compare
e32fa63
to
f3e3ab5
Compare
Motivation
The current implementation of the tx history streaming does not have a flow control mechanism. After running some stress tests, we learned that wallets might not be able to process transactions at the same rate the full node is sending them. So, this PR introduces a flow control mechanism using a sequence number and an ACK number.
Here's an incomplete design of the flow control mechanism: https://github.com/HathorNetwork/internal-rfcs/pull/25
Acceptance Criteria
seq: int
to each stream message (except begin, end and error).StreamBeginMessage.sliding_window_size: Optional[int]
where none means "no flow control".window-size
attribute to the create stream websocket commandsxpub
andmanual
.window-size
is missing, the default value is used.window-size
is a number, the provided value is used.window-size
is the number is negative, the flow control is disabled.request:history:ack
that sets the ack number and optionally modifies the window size._sliding_window_size
messages without receiving an ack. Then it will wait for an ack (or a change in the window size) to resume.Checklist
master
, confirm this code is production-ready and can be included in future releases as soon as it gets merged