Skip to content

Commit

Permalink
chore: included docs and wg allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenrinzema committed Aug 30, 2023
1 parent 1a48cf1 commit 034e656
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion command.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func (srv *Server) consumeCommands(ctx context.Context, conn net.Conn, reader *b
return err
}

srv.wg.Add(1)
err = srv.handleCommand(ctx, conn, t, reader, writer)
if errors.Is(err, io.EOF) {
return nil
Expand Down Expand Up @@ -114,6 +113,9 @@ func (srv *Server) handleCommand(ctx context.Context, conn net.Conn, t types.Cli
ctx, cancel := context.WithCancel(ctx)
defer cancel()

// NOTE: we increase the wait group by one in order to make sure that idle
// connections are not blocking a close.
srv.wg.Add(1)
defer srv.wg.Done()

switch t {
Expand Down

0 comments on commit 034e656

Please sign in to comment.