Skip to content
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

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pkg/rpcbackend/wsbackend.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (rc *wsRPCClient) addConfiguredSub(ctx context.Context, params []interface{
rc: rc,
localID: fftypes.NewUUID(),
params: params,
newSubResponse: make(chan *RPCError),
newSubResponse: make(chan *RPCError, 1),
notifications: make(chan *RPCSubscriptionNotification), // blocking channel for these, but Unsubscribe will unblock by cancelling ctx
}
s.ctx, s.cancelCtx = context.WithCancel(ctx)
Expand Down Expand Up @@ -457,7 +457,9 @@ func (rc *wsRPCClient) handleSubscriptionConfirm(ctx context.Context, inflightSu
log.L(ctx).Infof("Subscribed %s with server subscription ID '%s'", inflightSub.localID, subscriptionID)
rc.addActiveSub(inflightSub, subscriptionID)
// all was good, if someone is waiting to be told, notify them
resChl <- nil
if resChl != nil {
resChl <- nil
}
}

func (rc *wsRPCClient) deliverCallResponse(ctx context.Context, inflightCall chan *RPCResponse, rpcRes *RPCResponse) {
Expand Down
Loading