syncutil

package
v0.69.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 2 Imported by: 1 module, 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

Overview

Package syncutil provides concurrency utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtMost

type AtMost struct {
	// contains filtered or unexported fields
}

AtMost executes a function at most once per the configured interval. Subsequent calls within the interval are silently skipped. Safe for concurrent use from multiple goroutines.

func NewAtMost

func NewAtMost(interval time.Duration) *AtMost

NewAtMost creates an AtMost that allows execution at most once per interval. The first call to Do always executes.

func (*AtMost) Do

func (a *AtMost) Do(fn func())

Do calls fn if at least interval has elapsed since the last successful invocation. Otherwise the call is silently skipped. The first call always executes because last is initialized to zero, which is treated as "never called".

Jump to

Keyboard shortcuts

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