clock

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package clock holds the wait seam every retry and poll loop sleeps through. Production code sleeps with Sleep, which ends early when the context ends (a SIGINT cancels the command context, see cli.WatchInterrupt); tests install NoSleep so waits are instant.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoSleep

func NoSleep(ctx context.Context, _ time.Duration) error

NoSleep is the test fake: it returns at once. It still reports an ended context, so a loop under test stops on a cancel the way it does in production.

func Sleep

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

Sleep is the production SleepFunc.

Types

type SleepFunc

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

SleepFunc waits d or until ctx ends. It returns nil after a full wait and ctx.Err() when the context ended first, so a loop that sleeps through it stops on a cancel instead of running its remaining retries.

Jump to

Keyboard shortcuts

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