Help us shape the future of Go! Take the 2026 Go Developer Survey

schedule

package
v0.37.2 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package schedule holds the pure timing functions of bentoo-tray: the startup delay, the jittered check interval and the failure backoff. Randomness is injected as r in [0,1) so every bound is testable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backoff

func Backoff(failures int, retryAfter time.Duration) time.Duration

Backoff returns the delay after the given number of consecutive failures: 5 minutes doubled per failure beyond the first, capped at 24 hours, and never shorter than retryAfter. The doubling stops at the cap before it could overflow; a count below 1 is treated as 1.

func NextInterval

func NextInterval(base time.Duration, r float64) time.Duration

NextInterval returns base varied by ±20%: base × [0.8, 1.2).

func StartupDelay

func StartupDelay(r float64) time.Duration

StartupDelay returns the delay before the first fetch, 1 to 5 minutes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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