-
Notifications
You must be signed in to change notification settings - Fork 13
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
Fix auto reconnect for RPC WebSocket #53
Conversation
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Digging into this... it needs some thinking to understand why it's nil - and I've not spotted that in code comments or the PR comment. |
Agreed. I'm not sure why it's |
So I see here that we set it into firefly-signer/pkg/rpcbackend/wsbackend.go Line 438 in 356a095
@nguyer - I think to review this, I need a bit more information. |
More likely from just code inspection to me would seem like:
... if that were the bug, then the fix would be on this line: firefly-signer/pkg/rpcbackend/wsbackend.go Line 223 in 356a095
to change it to |
I just did a quick test of this and it still resulted in I will keep digging. |
Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
After digging into this more, it looks like this is the expected behavior that we only send the notification when the subscription is new, and not on reconnects: firefly-signer/pkg/rpcbackend/wsbackend.go Lines 228 to 230 in 356a095
|
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.
Thanks @nguyer, and for pointing me at:
firefly-signer/pkg/rpcbackend/wsbackend.go
Lines 228 to 230 in 356a095
// need to return newSubResponse because it's a use-once thing (not on reconnect) | |
// and will be nilled out (under lock) when the first creation response comes in | |
return s, s.newSubResponse |
I understand now the nil
case I think, but I actually think we also need the , 1
change for another potential edge case I mention around the context.
So let's include both changes.
In the case of a reconnect the
resChl
wasnil
so sendingnil
to it ended up blocking, causing the receiver to not receive any further messages.