overtime

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL