poll

package
v1.0.0-rc.7 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package poll waits for a condition that nothing announces: a container turning healthy, a daemon starting to answer. It is the one loop for that, so every wait is bounded, checks the condition once more at its deadline, and stops early when its context ends. Wait is the pause between two attempts of a loop that is not a condition — a retry's backoff, a follow loop's interval — and ends early with its context too. Neither reads a clock: each is timed by timers, so a test's synctest bubble times it too. A test's check that something does not happen is polltest.Holds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Until

func Until(ctx context.Context, timeout, interval time.Duration, cond func() bool) bool

Until checks cond at once and then every interval until it holds, the timeout passes or ctx ends. It reports whether cond held. The last check is made at the deadline, so a condition that comes true during the final interval is still seen.

func Wait

func Wait(ctx context.Context, d time.Duration) error

Wait waits for d, or until ctx ends, and returns ctx's error when it ended first (or had already ended); nil when d passed.

Types

This section is empty.

Directories

Path Synopsis
Package polltest is poll's converse for tests: the check that something does not happen for a while, and the bound for a wait whose length is not what a test checks.
Package polltest is poll's converse for tests: the check that something does not happen for a while, and the bound for a wait whose length is not what a test checks.

Jump to

Keyboard shortcuts

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