ctxutil

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package ctxutil provides context helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SigTerm added in v1.17.0

func SigTerm(parent context.Context) (context.Context, context.CancelFunc)

SigTerm returns a copy of the parent context that is marked done (its Done channel is closed) when termination signal arrives, when the returned stop function is called, or when the parent context's Done channel is closed, whichever happens first.

func Sleep added in v0.7.0

func Sleep(ctx context.Context, d time.Duration)

Sleep pauses the current goroutine until d has passed or ctx is canceled.

func SleepWithJitter added in v1.1.0

func SleepWithJitter(ctx context.Context, d time.Duration, attempts int64)

SleepWithJitter pauses the current goroutine until d + jitter has passed or ctx is canceled.

func WithDelay

WithDelay returns a copy of the parent context (with its values), which is canceled when returned context.CancelCauseFunc is called (without any delay), or when the parent is canceled and 3 seconds have passed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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