Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithOvertimeContext ¶
func WithOvertimeContext(parent context.Context, overtime time.Duration) (context.Context, context.CancelFunc)
Creates a new context that is valid for the duration of the parent context + overtime.
This may be of used for deferred cleanup steps that require a context.
Example usage:
ctx, cancel := context.WithTimeout(context.Background(), 10 * time.Minute) cleanupCtx, cleanupCancel := overtime.WithOvertimeContext(ctx, 1 * time.Minute) defer cleanupCancel() stuff := CreateSomethingTemporary(ctx) defer DestroyTemporary(cleanupCtx, stuff)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.