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
Subscription Pairs and Encapsulation #1501
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 #1501 +/- ##
==========================================
- Coverage 36.04% 36.02% -0.03%
==========================================
Files 411 415 +4
Lines 176906 177039 +133
==========================================
Hits 63774 63774
- Misses 105351 105475 +124
- Partials 7781 7790 +9
|
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.
Awesome update. Just a once over before I test all the changes. 🚀
3149dba
to
d7e5c4c
Compare
d2622f0
to
6774e9d
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.
This is a big PR with many changes so it will take multiple looks. I'm overall happy with the design of it all, along with the expansion of configurable subscriptions
73b8699
to
c3250d3
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.
Good stuff this is looking really good. 🚀
If the exchange passed in already has a websocket, don't clobber it
instead of errChannelAlreadySubscribed
Given that some subscriptions have multiple pairs, support that as the standard.
We deliberately use Equal over Len to avoid spamming the contents of large Slices
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.
Feels like there's still heaps more for me to go over and test. So here's some things I've thought about while reviewing
@@ -212,11 +214,10 @@ func New(input string) (Item, error) { | |||
return USDCMarginedFutures, nil | |||
case options, "option": | |||
return Options, nil | |||
case all: |
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 my own personal review comment to say that I have reviewed the manner of all
and am satisfied. This is to prevent me from reviewing it out of concern every single time I review this PR
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.
Things are looking good. My next review run will go over running each exchange to verify that existing functionality is maintained
if s.Key == nil { | ||
s.Key = DefaultKey{ | ||
Channel: s.Channel, | ||
Asset: s.Asset, | ||
Pair: s.Pair, | ||
} | ||
s.Key = &ExactKey{s} | ||
} | ||
return s.Key |
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 looke like it should have mutex use now
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.
Fixed bd73186
if k, ok := key.(MatchableKey); ok { | ||
return k.String() | ||
} | ||
return fmt.Sprintf("%v: %s", key, ExactKey{s}.String()) |
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 like a potential race zone
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.
Yeah. Not particularly easy to get around, either.
Fixed 913fb2d
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1501 +/- ##
==========================================
- Coverage 36.04% 36.02% -0.03%
==========================================
Files 411 415 +4
Lines 176906 177039 +133
==========================================
Hits 63774 63774
- Misses 105351 105475 +124
- Partials 7781 7790 +9
|
This work starts the process of disentangling subscriptions from websocket, since a subscription is an exchange concept, and we want the collection of subscriptions separate from each websocket so we can start to separate auth, non-auth, assets, private and multiplexed websockets
For some exchanges we've immediately made full use of this.
For others we've ported over the existing one-pair method, and will revist it when we tackle subscription configuration
Type of change
How has this been tested