Documentation
¶
Index ¶
- Constants
- type Args
- type Dispatcher
- func (d Dispatcher) AddHandler(queue string, fn func(Args) error)
- func (d Dispatcher) CancelBatch(queue string, batchID string, cancelledBy string) (int64, error)
- func (d Dispatcher) CancelTask(queue string, index int64, cancelledBy string) (int64, error)
- func (d Dispatcher) Close() error
- func (d Dispatcher) EnqueueJob(job *Job) error
- func (d Dispatcher) GetTaskLists() ([]string, error)
- func (d Dispatcher) ListJobs(queueName string) ([]*Job, error)
- func (d Dispatcher) RemoveQueue(queue string, queueType queueType) (err error)
- func (d Dispatcher) RemoveSwn(userID int64, slug string, lastOnly bool) error
- func (d Dispatcher) Run()
- type Job
- type Meta
- type Worker
Constants ¶
View Source
const ( TypeQueued queueType = iota TypeScheduled queueType = iota TypePeriodic queueType = iota )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
WorkerPool chan chan Job
MaxWorkers int
// contains filtered or unexported fields
}
func NewDispatcher ¶
func NewDispatcher(namespace, redisURL string, maxWorkers int) *Dispatcher
func (Dispatcher) AddHandler ¶
func (d Dispatcher) AddHandler(queue string, fn func(Args) error)
func (Dispatcher) CancelBatch ¶
func (Dispatcher) CancelTask ¶
func (Dispatcher) Close ¶
func (d Dispatcher) Close() error
func (Dispatcher) EnqueueJob ¶
func (d Dispatcher) EnqueueJob(job *Job) error
EnqueueJob ads a job to the queue and will be run as soon as possible
func (Dispatcher) GetTaskLists ¶
func (d Dispatcher) GetTaskLists() ([]string, error)
func (Dispatcher) RemoveQueue ¶
func (d Dispatcher) RemoveQueue(queue string, queueType queueType) (err error)
func (Dispatcher) RemoveSwn ¶
func (d Dispatcher) RemoveSwn(userID int64, slug string, lastOnly bool) error
func (Dispatcher) Run ¶
func (d Dispatcher) Run()
type Job ¶
type Job struct {
Queue string `json:"queue"`
Args Args `json:"args"`
BatchID string `json:"batch_id"`
Error string `json:"error,omitempt"`
CreatedAt *time.Time `json:"created_at,omitempty"`
RunAt *time.Time `json:"run_at,omitempty"`
Cron string `json:"cron,omitempty"`
LastRun *time.Time `json:"last_run,omitempty"`
Retry int64 `json:"retry"`
Type queueType `json:"type"`
CancelledAt *time.Time `json:"cancelled_at,omitempty"`
ProcessedAt *time.Time `json:"processed_at,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
CancelledBy string `json:"cancelled_by,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.