-- import "delay"
Package delay allows scheduling of functions to be invoked after a timeout. It provides an alternative to the idiomatic Go way of doing
go func() { time.Sleep(timeout); doStuff() }()
when there's a need to schedule thousands or millions of timeouts.
type DelayCaller struct {
// contains filtered or unexported fields
}
Type of the delayed call facility instances.
func New() *DelayCaller
Create a new delayed call facility instance.
func (cl *DelayCaller) Schedule(d time.Duration, fn func())
Schedule a function to be called after the specified timeout.
func (cl *DelayCaller) Stop()
Stop the facility.