timeout

package
v0.0.0-...-684cf26 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config) goresilience.Runner

New will wrap a execution unit that will cut the execution of a runner when some time passes using the context. use 0 timeout for default timeout.

func NewMiddleware

func NewMiddleware(cfg Config) goresilience.Middleware

NewMiddleware returns a middleware that will cut the execution of a runner when some time passes using the context. use 0 timeout for default timeout.

Types

type Config

type Config struct {
	// Timeout is the duration that will be waited before giving as a timeouted execution.
	Timeout time.Duration
	// Cancel decides if a context is canceled on a timeouted execution.
	// This is useful to stop the middleware chain on timeout.
	Cancel bool
}

Config is the configuration of the timeout.

Jump to

Keyboard shortcuts

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