Skip to content

Commit

Permalink
ensure context is cancelled to prevent goroutine leaks from grpc.newC…
Browse files Browse the repository at this point in the history
…lientStream
  • Loading branch information
coryb committed Jan 7, 2020
1 parent f7cf482 commit 31d21fb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion util/flightcontrol/flightcontrol.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ func newCall(fn func(ctx context.Context) (interface{}, error)) *call {

func (c *call) run() {
defer c.closeProgressWriter()
v, err := c.fn(c.ctx)
ctx, cancel := context.WithCancel(c.ctx)
defer cancel()
v, err := c.fn(ctx)
c.mu.Lock()
c.result = v
c.err = err
Expand Down

0 comments on commit 31d21fb

Please sign in to comment.