Skip to content

Commit

Permalink
Merge #111616
Browse files Browse the repository at this point in the history
111616: server: exit logging goroutine if work is done r=rafiss a=rafiss

Previously, this goroutine would remain open even after the number of open connections reached 0. Now, once it reaches 0, the logging goroutine will exit.

Epic: None
Release note: None

Co-authored-by: Rafi Shamim <[email protected]>
  • Loading branch information
craig[bot] and rafiss committed Oct 3, 2023
2 parents f157ff5 + 4e0d257 commit 5d3ba2d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/server/drain.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,11 @@ func (s *drainServer) logOpenConns(ctx context.Context) error {
for {
select {
case <-ticker.C:
log.Ops.Infof(ctx, "number of open connections: %d\n", s.sqlServer.pgServer.GetConnCancelMapLen())
openConns := s.sqlServer.pgServer.GetConnCancelMapLen()
log.Ops.Infof(ctx, "number of open connections: %d\n", openConns)
if openConns == 0 {
return
}
case <-s.stopper.ShouldQuiesce():
return
case <-ctx.Done():
Expand Down

0 comments on commit 5d3ba2d

Please sign in to comment.