timer

package
v0.0.0-...-a87a6b4 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RepeatTimer

type RepeatTimer struct {
	Ch chan time.Time
	// contains filtered or unexported fields
}

RepeatTimer repeatedly sends a struct{}{} to .Ch after each "dur" period. It's good for keeping connections alive. A RepeatTimer must be Stop()'d or it will keep a goroutine alive.

func NewRepeatTimer

func NewRepeatTimer(name string, dur time.Duration) *RepeatTimer

func (*RepeatTimer) Reset

func (t *RepeatTimer) Reset()

Wait the duration again before firing.

func (*RepeatTimer) Stop

func (t *RepeatTimer) Stop() bool

For ease of .Stop()'ing services before .Start()'ing them, we ignore .Stop()'s on nil RepeatTimers.

type ThrottleTimer

type ThrottleTimer struct {
	Name string
	Ch   chan struct{}
	// contains filtered or unexported fields
}

ThrottleTimer fires an event at most "dur" after each .Set() call. If a short burst of .Set() calls happens, ThrottleTimer fires once. If a long continuous burst of .Set() calls happens, ThrottleTimer fires at most once every "dur".

func NewThrottleTimer

func NewThrottleTimer(name string, dur time.Duration) *ThrottleTimer

func (*ThrottleTimer) Set

func (t *ThrottleTimer) Set()

func (*ThrottleTimer) Stop

func (t *ThrottleTimer) Stop() bool

For ease of .Stop()'ing services before .Start()'ing them, we ignore .Stop()'s on nil ThrottleTimers

func (*ThrottleTimer) Unset

func (t *ThrottleTimer) Unset()

Jump to

Keyboard shortcuts

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