Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PollingFunc ¶ added in v1.1.0
type Pool ¶ added in v1.1.0
type Pool interface {
Start() // Start the pool and all its workers (must be called in a goroutine)
Stop() // Wait for the current pool to complete and returns
}
Generic interface for an async worker which can be started and stopped.
func NewPool ¶ added in v1.1.0
func NewPool[T any]( logger log.Logger, interval time.Duration, pollingFunc PollingFunc[T], nameFunc NameFunc[T], groups ...*group[T], ) Pool
Builds a new pool which will call the given handler func at the specified interval. The handler will be called for each group of jobs which have not reached their capacity and it will received the group tags as argument so that you can filter the job being returned.
The idea behind pool groups is that some jobs need more time to complete and I don't want to hold back the other ones such as (in the future), sending emails, checking stuff, etc.
Click to show internal directories.
Click to hide internal directories.