What is the URL of the page with the issue?
N/A
What is your user agent?
N/A
Screenshot
No response
What did you do?
This is a feature request. time.Sleep() is a blocking call and cannot be cancelled. Add a helper to support context cancellation to help build more responsive tools.
What did you see happen?
N/A
What did you expect to see?
New function:
package time
func SleepC(ctx context.Context, d time.Duration) error {
select {
case <-ctx.Done():
return ctx.Err()
case <-time.After(d):
return nil
}
}