Documentation ¶
Index ¶
Constants ¶
View Source
const (
TimestampFormat = "2006-01-02 15:04:05 MST"
)
Variables ¶
View Source
var Client = NewClientConfig()
View Source
var Workers = NewWorkerConfig()
Functions ¶
Types ¶
type ClientConfig ¶
type ClientConfig struct { RedisPool *redis.Pool RedisNamespace string Fake bool // contains filtered or unexported fields }
func NewClientConfig ¶
func NewClientConfig() *ClientConfig
func (*ClientConfig) QueueJob ¶
func (c *ClientConfig) QueueJob(worker Worker) error
func (*ClientConfig) QueueJobConfig ¶
func (c *ClientConfig) QueueJobConfig(worker Worker, config JobConfig) error
func (*ClientConfig) Register ¶
func (c *ClientConfig) Register(worker Worker, queue string, retries int)
func (*ClientConfig) RegisterName ¶
func (c *ClientConfig) RegisterName(name string, worker Worker, queue string, retries int)
type Job ¶
type Job struct { Type string `json:"class"` Args *json.RawMessage `json:"args"` Queue string `json:"queue,omitempty"` ID string `json:"jid"` Retry interface{} `json:"retry"` // can be int (number of retries) or bool (true means default) MaxRetries int `json:"-"` RetryCount int `json:"retry_count"` ErrorMessage string `json:"error_message,omitempty"` ErrorType string `json:"error_class,omitempty"` RetriedAt string `json:"retried_at,omitempty"` FailedAt string `json:"failed_at,omitempty"` StartTime time.Time `json:"-"` }
type PanicError ¶
type PanicError struct { Err interface{} Stack []StackFrame }
func (*PanicError) Error ¶
func (err *PanicError) Error() string
type QueueConfig ¶
func (QueueConfig) String ¶
func (q QueueConfig) String() string
type ReportableErrorChecker ¶
type StackFrame ¶
type UnknownWorkerError ¶
type UnknownWorkerError struct{ Type string }
func (UnknownWorkerError) Error ¶
func (e UnknownWorkerError) Error() string
type WorkerConfig ¶
type WorkerConfig struct { RedisPool *redis.Pool RedisNamespace string Queues QueueConfig WorkerCount int PollInterval time.Duration StopTimeout time.Duration ReportError func(error, *Job) sync.RWMutex // R is locked by Run() and scheduler(), W is locked by quitHandler() when it receives a signal // contains filtered or unexported fields }
func NewWorkerConfig ¶
func NewWorkerConfig() *WorkerConfig
func (*WorkerConfig) Register ¶
func (w *WorkerConfig) Register(worker Worker)
func (*WorkerConfig) RegisterName ¶
func (w *WorkerConfig) RegisterName(name string, worker Worker)
func (*WorkerConfig) Run ¶
func (w *WorkerConfig) Run()
Click to show internal directories.
Click to hide internal directories.