once

package
v0.2024.5 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPanicSuppressed = errors.New("panic suppressed")
)

Functions

This section is empty.

Types

type RetryError

type RetryError struct {
	// contains filtered or unexported fields
}

RetryError is like sync.Once except if f returns an err Do will try again the next time it's called.

func (*RetryError) Do

func (o *RetryError) Do(ctx context.Context, f func() error) error

Do calls f if Do has not successfully been called before. Do will return before f completes if ctx is done, f will continue to run until it returns. Concurrent calls to Do will wait until the first f completes, returning that error. Subsequent calls to Do after an error will invoke f as if Do had not been called before.

Jump to

Keyboard shortcuts

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