-
Notifications
You must be signed in to change notification settings - Fork 837
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
Huobi: V2 subscription support #1703
Conversation
06c750a
to
8d0146d
Compare
8d0146d
to
2f10c4b
Compare
Linter fixed; Rebased to resolve conflict |
2f10c4b
to
b88173c
Compare
b88173c
to
ac7b14a
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.
Awesome update. 🍰 Just some minor nits.
ff199aa
to
479095c
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.
Changes ACK, Thanks 🫡
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.
Nicely done
exchanges/huobi/huobi_websocket.go
Outdated
h.Websocket.SetCanUseAuthenticatedEndpoints(false) | ||
if h.IsWebsocketAuthenticationSupported() { |
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.
?
I don't see any other exchange behave in this manner
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.
In which sense?
Most of them use SetCanUseAuthenticatedEndpoints
false on failure (Kraken, Okx)
Many of them use IsWebsocketAuthenticationSupported
to choose to dial auth (Kraken, Okx)
This is using a different pattern, but I'm actually happier with it.
Set CanUseAuthEndpoints to false on a (re)connect, and then true if the auth succeeds.
It feels cleaner than having the branching logic we've seen elsewhere.
Definitely cleaner than using CanUseAuthenticatedEndpoints
to decide to even dial, which I saw on one exchange, and feels definitely wrong.
Is there a downside to this that I'm missing?
If anything, I'd follow this pattern with others when I'm interfering with them.
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.
Why set something to false when you don't even know if they have credentials set or if its going to be used?
If you put the h.Websocket.SetCanUseAuthenticatedEndpoints(false)
inside the if statement, it no longer looks out of place and that change will still work with all the reasoning you outlined
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.
Why set something to false when you don't even know if they have credentials set or if its going to be used?
Because if we aren't about to go into theif
statement, for any reason at all, thenfalse
is the correct state for the value. Not setting it to false seems wrong to me; Doing it inside an if statement that could be false and not run seems wrong to me.
I don't know what the use-cases might be. Feels like the user would have to unset credentials for it to need to be set to false where I have it. But that's kind of irrelevant. My point is that it's the best representation of the state at the right time.
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.
Kinda afraid you're going to ask me to change all the others if I convince you 🤦
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.
After 30 days, I still don't like it, nor would I request you put it anywhere else. I didn't expect to talk this much about h.Websocket.SetCanUseAuthenticatedEndpoints(false)
placement which doesn't affect performance. Its just doing something before even knowing its necessary.
Since it affects so little, I can say you can keep it, even though its a wasteful call without credentials
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.
I too don't see the point of this, we should only SetCanUseAuthenticatedEndpoints(false) if auth fails. We'll also always default to off unless a user has provided auth credentials and enabled websocket, which we'll test upon engine starting up
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.
Okay; I'll change it.
I'm still sticking to my view that WsConnect
is the point at which we have lost whatever possible authenticated state we had before, not on failed auth response.
( Arguably we lost it on disconnect )
So if reconnect and we don't go into h.IsWebsocketAuthenticationSupported
for literally any reason now, or in the future, we've left the bool in the wrong state. I know that's an edge case. I just don't see the point in not coding for it.
Fixup coming.
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 gbjk@53425ab42
Moved the set to true up into WsConnect because that matches other exchanges (Kraken), and means setting true and false is in the same place.
This PR is stale because it has been open 30 days with no activity. Please provide an update on the progress of 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.
Just needs a rebase, thank you! 🌈
6938c55
to
4d1b1de
Compare
65e81e4
to
7bce893
Compare
Rebase required an additional fix: gbjk@65e81e470 Immediately folded that down and pushed. |
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.
tACK
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.
Fantastic work on this PR. Just two minor nits and then this LGTG
Per-instance future codes not getting cached causin occassional fails
95a9f51
to
a86a674
Compare
testexch.FixtureToDataHandlerWithErrors
Stacked Dependencies
Related
Type of change
Please delete options that are not relevant and add an
x
in[]
as item is complete.How has this been tested