Skip to content

Commit

Permalink
defer cancel()
Browse files Browse the repository at this point in the history
  • Loading branch information
robertodauria committed Jul 13, 2021
1 parent f1be0d7 commit 7afee97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/upload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ func Run(ctx context.Context, conn websocketx.Conn, ch chan<- spec.Measurement)
defer close(ch)
defer conn.Close()
ctx, cancel := context.WithTimeout(ctx, params.UploadTimeout)
defer cancel()
errCh := make(chan error)
go readcounterflow(ctx, conn, ch, errCh)
start := time.Now()
Expand All @@ -142,7 +143,6 @@ func Run(ctx context.Context, conn websocketx.Conn, ch chan<- spec.Measurement)
prev = now
}
}
cancel()

err := <-errCh
if err != nil {
Expand Down

0 comments on commit 7afee97

Please sign in to comment.