17 lines
474 B
Go
17 lines
474 B
Go
package temporal
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
// ContextWithTimeout creates a context with the given timeout.
|
|
func ContextWithTimeout(timeout time.Duration) (context.Context, context.CancelFunc) {
|
|
return context.WithTimeout(context.Background(), timeout)
|
|
}
|
|
|
|
// ContextWithDefault creates a context with a default timeout of 10 seconds.
|
|
func ContextWithDefault() (context.Context, context.CancelFunc) {
|
|
return context.WithTimeout(context.Background(), 10*time.Second)
|
|
}
|