-
Notifications
You must be signed in to change notification settings - Fork 822
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
stream: force subscription store count check as stop gap for wrapper side implementation #1717
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1717 +/- ##
==========================================
- Coverage 37.15% 37.13% -0.02%
==========================================
Files 414 414
Lines 180198 180199 +1
==========================================
- Hits 66950 66916 -34
- Misses 105389 105428 +39
+ Partials 7859 7855 -4
|
I have concerns about building this out further:
|
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.
Given comment, I don't see a way to move this forward right now.
I feel like the manageSubs is the only place we can properly manage sub state.
One edge case in the back of my mind is resubscribing, as well, particularly on orderbook fail.
These are all fair points, an option I will investigate is check the connection subscription status after subscriptions to see if they have been added or removed. So that at least it complains that it needs to be added in the exchange packages themselves. |
@shazbert Just realised that I haven't mentioned: I completely agree about abstracting from exchange implementations. I'm just not yet ready to see how to do it. I've been looking to abstract this, but I don't think we're ready yet because too much is in flight and unmerged. |
@gbjk I have added in new code now with fixes, when you have time could you please check them out. |
if err := w.UnsubscribeChannels(c, unsubs); err != nil { | ||
return err | ||
} | ||
if diff := prevState - store.Len(); diff != len(unsubs) { |
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 doesn't feel right ...
- Shouldn't Unsubscribe be erroring if it wasn't successful ?
- Shouldn't the state of all subs in unsubs be changing ?
That said, it's not too bad either.
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.
Shouldn't Unsubscribe be erroring if it wasn't successful ?
I think it should, I just added it as a catch all in the event we forgot to remove it from the store when it was successful. Then it should complain. should 😬
Shouldn't the state of all subs in unsubs be changing
Now you are making me think this is all completely wrong 😆. This specifically didn't catch any issues. Can you suggest a better way as a back up check? Cause I am drooling at my screen trying to figure it out 🤤.
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.
It's not too invasive, and doesn't change too much, so I'm happy.
I'm working on sub management and routing separately for gateio, but this doesn't tread on any toes.
PR Description
Noticed in Bybit that subscriptions weren't being added when I was flushing the connection every hour,
so abstracted adding and removing to websocket package then I can merge this to the open PR chain. This is so we don't need to toil in the wrappers as well but there might be some edge cases I am not considering.This only impacts exchanges that are upgraded to the websocket multi connection.Added in checks in stream package so that the outbound subscriptions are added or removed from store.
Fixes bybit and Deribit
Type of change
Please delete options that are not relevant and add an
x
in[]
as item is complete.How has this been tested
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration and
also consider improving test coverage whilst working on a certain feature or package.
Checklist