Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
Cancel when the main context is done, as well
Browse files Browse the repository at this point in the history
Go's `case` statements do not fall through, so the `<-ctx.Done()`
case actually doesn't cancel the request.  This commit ensures
that the request is canceled if the main context is done, as well.
  • Loading branch information
tekkamanendless committed Feb 12, 2019
1 parent e620fbf commit dbe18d8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ func (s *Server) AutoComplete(ctx context.Context, req *AutoCompleteRequest, res
go func() {
select {
case <-ctx.Done():
cancel()
case <-s.context.Done():
cancel()
}
Expand Down

0 comments on commit dbe18d8

Please sign in to comment.