Commit 7b02592b authored by Mitar's avatar Mitar
Browse files

Fix race condition between context cancel and write to a channel.

parent 12c9ce10
Pipeline #443361833 passed with stages
in 2 minutes and 8 seconds
......@@ -104,10 +104,11 @@ func NewTicker(ctx context.Context, c counter, size int64, interval time.Duratio
remaining: estimated.Sub(now),
estimated: estimated,
}
if ctx.Err() != nil {
select {
case <-ctx.Done():
return
case output <- progress:
}
output <- progress
}
}
}()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment