rate

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RandTimer

type RandTimer struct {
	*time.Timer
	// contains filtered or unexported fields
}

func (*RandTimer) Channel

func (t *RandTimer) Channel() <-chan time.Time

func (*RandTimer) Reset

func (t *RandTimer) Reset()

func (*RandTimer) Stop

func (t *RandTimer) Stop() bool

func (*RandTimer) Wait

func (t *RandTimer) Wait()

type SpeedLimiter

type SpeedLimiter interface {
	Reset()
	Stop() bool

	Wait()

	Channel() <-chan time.Time
}

func NewRandSpeedLimiter

func NewRandSpeedLimiter(minInterval, maxInterval time.Duration) SpeedLimiter

minInterval:最小等待时间 maxInterval:最大等待时间 maxInterval-minInterval: 等待范围

func NewSpeedLimiter

func NewSpeedLimiter(interval time.Duration) SpeedLimiter

type Ticker

type Ticker time.Ticker

func (*Ticker) Channel

func (t *Ticker) Channel() <-chan time.Time

func (*Ticker) Reset

func (t *Ticker) Reset()

func (*Ticker) Stop

func (t *Ticker) Stop() bool

func (*Ticker) Wait

func (t *Ticker) Wait()

Jump to

Keyboard shortcuts

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