Fix issue with multiple subscriptions#4406
Merged
melekes merged 7 commits intotendermint:masterfrom Feb 17, 2020
mesg-foundation:fix/multi-subscription-ws
Merged
Fix issue with multiple subscriptions#4406melekes merged 7 commits intotendermint:masterfrom mesg-foundation:fix/multi-subscription-ws
melekes merged 7 commits intotendermint:masterfrom
mesg-foundation:fix/multi-subscription-ws
Conversation
golangcibot
reviewed
Feb 14, 2020
Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>
Codecov Report
@@ Coverage Diff @@
## master #4406 +/- ##
==========================================
- Coverage 65.8% 65.77% -0.04%
==========================================
Files 225 225
Lines 19952 19947 -5
==========================================
- Hits 13130 13120 -10
Misses 5770 5770
- Partials 1052 1057 +5
|
melekes
reviewed
Feb 14, 2020
Contributor
melekes
left a comment
There was a problem hiding this comment.
Good catch 👍 Thank you for the fix 🙏
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
melekes
approved these changes
Feb 14, 2020
Contributor
|
Could you also add a CHANGELOG_PENDING.md entry? |
…oundation/tendermint into fix/multi-subscription-ws
melekes
reviewed
Feb 15, 2020
5 tasks
Co-Authored-By: Anton Kaliaev <anton.kalyaev@gmail.com>
melekes
approved these changes
Feb 16, 2020
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Using the WebSocket server, when the same client calls multiple time the
subscribemethod, only the last subscription receives all the events of the previous ones.example:
In this case, subscription2 will receive the new blocks but subscription1 will not.
This came from the WebSocket handler that had the declaration of the rpcrequest moved and so overridden for every request and given in the JSONReq client context (so the id of the subscription was not the right one).
This fixes the issue by simply declaring the rpcrequest inside the loop so every request will create a new object without overwriting the previous one.