mirror of
https://github.com/fluxcd/flagger.git
synced 2026-04-15 06:57:34 +00:00
16 lines
210 B
Go
16 lines
210 B
Go
package contextutils
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
func Sleep(ctx context.Context, amount time.Duration) error {
|
|
select {
|
|
case <-time.After(amount):
|
|
return nil
|
|
case <-ctx.Done():
|
|
return ctx.Err()
|
|
}
|
|
}
|