Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TickerPool ¶
TickerPool represents a pool of workers set to perform a task periodically. A TickerPool has a set of workers which can grow and shrink dynamically.
func NewTickerPool ¶
NewTickerPool creates a TickerPool with a set interval.
func (*TickerPool) Add ¶
func (tp *TickerPool) Add(name string, task func(context.Context)) (exists bool)
Add schedules a new worker to spin up on the TickerPool's interval. The task will not fire right away but as soon as the new worker interval is calculated and the task is assigned a position.
func (*TickerPool) Exists ¶
func (tp *TickerPool) Exists(name string) bool
Exists checks if a worker exists in the pool
func (*TickerPool) Remove ¶
func (tp *TickerPool) Remove(name string)
Remove simply removes a worker from the pool, no other action is required as if there is a queue running, it will stop itself if there are no more workers.
Click to show internal directories.
Click to hide internal directories.