Documentation
¶
Overview ¶
Package scheduler enqueues the periodic tasks on their schedules, in the application's time zone. Every replica runs a scheduler; a tick's task id names its slot, so the replicas' enqueues of one slot collapse into one task.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service enqueues the periodic tasks. Every process runs one, so a tick is enqueued under a task ID naming the task type and the tick's slot: the replicas firing for the same slot collide on that ID (asynq keeps it while the task is pending, running, retrying or retained as completed) and only the first enqueue lands. asynq.Unique cannot do this: it releases its lock as soon as the task succeeds, so a replica ticking after that enqueues the slot again. A slot's task never blocks the next slot, however long it runs.
func NewService ¶
func NewService(redisOpt asynq.RedisConnOpt, appLocation string) *Service
NewService builds the scheduler on the queue's Redis connection; the composition root owns that connection's settings.