poll

package
v0.19.1302 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NonRetryableError = errors.New("non-retryable")
	ExhaustedError    = errors.New("exhausted attempts new")
	ContinueAsNewErr  = errors.New("continue as new")
)

Functions

func Poll

func Poll(ctx workflow.Context, v *validator.Validate, opts PollOpts) error

Types

type PollOpts

type PollOpts struct {
	MaxTS           time.Time     `validate:"required"`
	InitialInterval time.Duration `validate:"required"`
	MaxInterval     time.Duration `validate:"required"`
	BackoffFactor   float64       `validate:"required"`
	// If set to > 0, Poll with return the ContinueAsNewErr after every N attempts.
	ContinueAsNewAfterAttempts int      `validate:"min=0"`
	Fn                         PollerFn `validate:"required"`

	PostAttemptHook func(workflow.Context, time.Duration) error
}

type PollerFn

type PollerFn func(context workflow.Context) error

NOTE(jm): we use this pattern in many workflows, and while we do want to move to using signals to make it easier to control flow, this approach is still common.

Setting ContinueAsNewAfterAttempts to >0 will return ContinueAsNewErr after the given number of attempts. Use this to return workflow.ContinueAsNewErr to temporal for doing continue-as-new polling.

Jump to

Keyboard shortcuts

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