Documentation ¶
Index ¶
- Variables
- func NewScheduleWorker(db *sql.DB, queue queue.Queuer, interval time.Duration) queue.Worker
- func NewTaskWorker(dequeuer queue.Dequeuer, handler queue.TaskHandler) queue.Workerdeprecated
- func NewTaskWorkerWithOpts(dequeuer queue.Dequeuer, handler queue.TaskHandler, opts Options) queue.Worker
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrHeartbeatTimeout is returned from the worker when the task heartbeat is too slow, // tasks must heartbeat every 15s or else the worker abandons he task. The task is // not marked as a failure, but can be restarted by another worker. ErrHeartbeatTimeout = fmt.Errorf("task timeout") )
View Source
var ( // ErrScheduleQueueIsEmpty occurs when there is no schedule with // the `next_execution_time` in the past ErrScheduleQueueIsEmpty = errors.New("nothing to schedule") )
Functions ¶
func NewScheduleWorker ¶
NewScheduleWorker creates a new task scheduling worker
func NewTaskWorker
deprecated
func NewTaskWorkerWithOpts ¶ added in v4.6.0
func NewTaskWorkerWithOpts(dequeuer queue.Dequeuer, handler queue.TaskHandler, opts Options) queue.Worker
NewTaskWorkerWithOpts creates a task Worker instance with the specified options.
Types ¶
type Options ¶ added in v4.6.0
type Options struct { // HeartbeatPeriod is the time the worker is allowed to wait for a heartbeat before // failing the task. If a task does not send a heartbeat before this value, then the task is // marked as failed. We recommend using a value like Queue.HeartbeatTTL + 100 time.Millisecond // to give your task handlers a little bit of extra time and avoiding any kind of race condition // between the heartbeat and the worker cleanup actually failing it. HeartbeatPeriod time.Duration }
Options controls how the worker behaves.
Click to show internal directories.
Click to hide internal directories.