periodiccaller

package
v0.0.0-...-12badae Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package periodiccaller allows periodic calls of functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(ctx context.Context, interval time.Duration, callback func()) func()

Start starts a timer that calls <callback> every <interval> until the <ctx> is canceled.

func StartWithJitter

func StartWithJitter(ctx context.Context, baseDuration time.Duration, jitter float64,
	callback func()) func()

StartWithJitter starts a timer that calls <callback> every <baseDuration+jitter> until the <ctx> is canceled. <jitter>, [0..1], is used to add +/- jitter to <baseDuration> at every iteration of the timer.

func StartWithManualTrigger

func StartWithManualTrigger(ctx context.Context, interval time.Duration, trigger chan bool,
	callback func(manualTrigger bool)) func()

StartWithManualTrigger starts a timer that calls <callback> every <interval> from <reset> channel until the <ctx> is canceled. Additionally the 'trigger' channel can be used to trigger callback immediately.

Types

This section is empty.

Jump to

Keyboard shortcuts

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