Skip to content

Commit

Permalink
Close coordinator-router connections after use (#596)
Browse files Browse the repository at this point in the history
  • Loading branch information
reshke authored Apr 2, 2024
1 parent 6d79093 commit e44f06a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions coordinator/provider/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ func (ci grpcConnectionIterator) IterRouter(cb func(cc *grpc.ClientConn, addr st
if err != nil {
return err
}
defer cc.Close()

if err := cb(cc, r.Address); err != nil {
return err
}
Expand Down Expand Up @@ -221,6 +223,8 @@ func (qc *qdbCoordinator) watchRouters(ctx context.Context) {
return err
}

defer cc.Close()

rrClient := routerproto.NewTopologyServiceClient(cc)

resp, err := rrClient.GetRouterStatus(ctx, &routerproto.GetRouterStatusRequest{})
Expand Down Expand Up @@ -385,9 +389,11 @@ func (qc *qdbCoordinator) traverseRouters(ctx context.Context, cb func(cc *grpc.
if err != nil {
return err
}
defer cc.Close()

if err := cb(cc); err != nil {
spqrlog.Zero.Debug().Err(err).Str("router id", rtr.ID).Msg("traverse routers")
return err
}

return nil
Expand Down

0 comments on commit e44f06a

Please sign in to comment.