Skip to content

Commit

Permalink
Merge pull request #53 from kaleido-io/fix-rpcws-reconnect
Browse files Browse the repository at this point in the history
Fix auto reconnect for RPC WebSocket
  • Loading branch information
nguyer authored Dec 1, 2023
2 parents 356a095 + 9e24f14 commit ec63452
Showing 1 changed file with 4 additions and 2 deletions.
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

0 comments on commit ec63452

Please sign in to comment.