contextutil

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDeadlineBuffer

func WithDeadlineBuffer(
	parent context.Context,
	timeout time.Duration,
	buffer time.Duration,
) (context.Context, context.CancelFunc)

WithDeadlineBuffer returns a child context with a deadline that ensures that at least buffer amount of time remains after the child deadline expires and before the parent deadline expires. The returned context timeout is therefore <= the requested timeout. If the parent deadline itself does not allow buffer amount of time, then the returned context deadline expires immediately. Use this method to create child context when the child cannot use all of parent's deadline but instead there is a need to leave some time for parent to do some post-work.

Types

This section is empty.

Jump to

Keyboard shortcuts

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