ticker

package
v0.0.0-...-fa598ba Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultTicker

type DefaultTicker struct {
	Ticker
	// contains filtered or unexported fields
}

DefaultTicker defines the template method to run periodically.

func NewDefaultTicker

func NewDefaultTicker(normalInterval, errorInterval time.Duration) *DefaultTicker

NewDefaultTicker creates a DefaultTicker instance

func (*DefaultTicker) DoTick

func (s *DefaultTicker) DoTick(ctx context.Context)

DoTick checks whether needs to check and calls TickImpl if needed.

func (*DefaultTicker) SetNextCheckTime

func (s *DefaultTicker) SetNextCheckTime(t time.Time)

SetNextCheckTime sets the next check time if ticker has checked or the given check time hits (lastCheckTime, nextCheckTime)

type Ticker

type Ticker interface {
	TickImpl(ctx context.Context) error
}

Ticker interface

Jump to

Keyboard shortcuts

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