Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultIDFunc ¶
func DefaultIDFunc() string
Types ¶
type Option ¶
type Option func(*Config)
func RestartAfter ¶
RestartAfter sets worker restart delay.
func WithContext ¶
WithContext sets parent context of workers.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func NewPool ¶
NewPool creates a new pool of given worker function. Since it starts with zero workers, the pool does not run workers until the first call of Resize. Workers can retrieve their id from the context using IDFromContext.
func (*Pool) Close ¶
func (p *Pool) Close()
Close cancels all running workers' context and wait for all workers to stop.
func (*Pool) KillWorker ¶
KillWorker kills the worker with given id, causing the pool to respawn a new worker. KillWorker returns false if there was no such worker.
Click to show internal directories.
Click to hide internal directories.