Cancelations is a collection that holds cancel functions for all active tasks.
Cancelations are safe for concurrent use by multiple goroutines. Add adds a new cancel func to the collection. Delete deletes a cancel func from the collection given an id. Get returns a cancel func given an id.
func NewCancelations() *Cancelations
Lease is a time bound lease for worker to process task.
It provides a communication channel between lessor and lessee about lease expiration.Clocktimeutil.Clock Deadline returns the expiration time of the lease. Done returns a communication channel from which the lessee can read to get notified when lessor notifies about lease expiration. IsValid returns true if the lease's expiration time is in the future or equals to the current time,
returns false otherwise. Sends a notification to lessee about expired lease
Returns true if notification was sent, returns false if the lease is still valid and notification was not sent. Reset changes the lease to expire at the given time.
It returns true if the lease is still valid and reset operation was successful, false if the lease had been expired.
*Lease : database/sql/driver.Validator
func NewLease(expirationTime time.Time) *Lease
SchedulerEntry holds information about a periodic task registered with a scheduler. Identifier of this entry. Next shows the next time the task will be enqueued. Opts is the options for the periodic task. Payload is the payload of the periodic task. Prev shows the last time the task was enqueued.
Zero time if task was never enqueued. Spec describes the schedule of this entry. Type is the task type of the periodic task.
func DecodeSchedulerEntry(b []byte) (*SchedulerEntry, error)
func github.com/hibiken/asynq/internal/rdb.(*RDB).ListSchedulerEntries() ([]*SchedulerEntry, error)
func EncodeSchedulerEntry(entry *SchedulerEntry) ([]byte, error)
func github.com/hibiken/asynq/internal/rdb.(*RDB).WriteSchedulerEntries(schedulerID string, entries []*SchedulerEntry, ttl time.Duration) error
TaskMessage is the internal representation of a task with additional metadata fields.
Serialized data of this type gets written to redis. CompletedAt is the time the task was processed successfully in Unix time,
the number of seconds elapsed since January 1, 1970 UTC.
Use zero to indicate no value. Deadline specifies the deadline for the task in Unix time,
the number of seconds elapsed since January 1, 1970 UTC.
If task processing doesn't complete before the deadline, the task will be retried
if retry count is remaining. Otherwise it will be moved to the archive.
Use zero to indicate no deadline. ErrorMsg holds the error message from the last failure. GroupKey holds the group key used for task aggregation.
Empty string indicates no aggregation is used for this task. Headers holds additional metadata for the task. ID is a unique identifier for each task. Time of last failure in Unix time,
the number of seconds elapsed since January 1, 1970 UTC.
Use zero to indicate no last failure Payload holds data needed to process the task. Queue is a name this message should be enqueued to. Retention specifies the number of seconds the task should be retained after completion. Retried is the number of times we've retried this task so far. Retry is the max number of retry for this task. Timeout specifies timeout in seconds.
If task processing doesn't complete within the timeout, the task will be retried
if retry count is remaining. Otherwise it will be moved to the archive.
Use zero to indicate no timeout. Type indicates the kind of the task to be performed. UniqueKey holds the redis key used for uniqueness lock for this task.
Empty string indicates that no uniqueness lock was used.
func DecodeMessage(data []byte) (*TaskMessage, error)
func Broker.Dequeue(qnames ...string) (*TaskMessage, time.Time, error)
func Broker.ListLeaseExpired(cutoff time.Time, qnames ...string) ([]*TaskMessage, error)
func Broker.ReadAggregationSet(qname, gname, aggregationSetID string) ([]*TaskMessage, time.Time, error)
func github.com/hibiken/asynq/internal/rdb.(*RDB).Dequeue(qnames ...string) (msg *TaskMessage, leaseExpirationTime time.Time, err error)
func github.com/hibiken/asynq/internal/rdb.(*RDB).ListLeaseExpired(cutoff time.Time, qnames ...string) ([]*TaskMessage, error)
func github.com/hibiken/asynq/internal/rdb.(*RDB).ReadAggregationSet(qname, gname, setID string) ([]*TaskMessage, time.Time, error)
func EncodeMessage(msg *TaskMessage) ([]byte, error)
func Broker.AddToGroup(ctx context.Context, msg *TaskMessage, gname string) error
func Broker.AddToGroupUnique(ctx context.Context, msg *TaskMessage, groupKey string, ttl time.Duration) error
func Broker.Archive(ctx context.Context, msg *TaskMessage, errMsg string) error
func Broker.Done(ctx context.Context, msg *TaskMessage) error
func Broker.Enqueue(ctx context.Context, msg *TaskMessage) error
func Broker.EnqueueUnique(ctx context.Context, msg *TaskMessage, ttl time.Duration) error
func Broker.MarkAsComplete(ctx context.Context, msg *TaskMessage) error
func Broker.Requeue(ctx context.Context, msg *TaskMessage) error
func Broker.Retry(ctx context.Context, msg *TaskMessage, processAt time.Time, errMsg string, isFailure bool) error
func Broker.Schedule(ctx context.Context, msg *TaskMessage, processAt time.Time) error
func Broker.ScheduleUnique(ctx context.Context, msg *TaskMessage, processAt time.Time, ttl time.Duration) error
func github.com/hibiken/asynq/internal/context.New(base context.Context, msg *TaskMessage, deadline time.Time) (context.Context, context.CancelFunc)
func github.com/hibiken/asynq/internal/rdb.(*RDB).AddToGroup(ctx context.Context, msg *TaskMessage, groupKey string) error
func github.com/hibiken/asynq/internal/rdb.(*RDB).AddToGroupUnique(ctx context.Context, msg *TaskMessage, groupKey string, ttl time.Duration) error
func github.com/hibiken/asynq/internal/rdb.(*RDB).Archive(ctx context.Context, msg *TaskMessage, errMsg string) error
func github.com/hibiken/asynq/internal/rdb.(*RDB).Done(ctx context.Context, msg *TaskMessage) error
func github.com/hibiken/asynq/internal/rdb.(*RDB).Enqueue(ctx context.Context, msg *TaskMessage) error
func github.com/hibiken/asynq/internal/rdb.(*RDB).EnqueueUnique(ctx context.Context, msg *TaskMessage, ttl time.Duration) error
func github.com/hibiken/asynq/internal/rdb.(*RDB).MarkAsComplete(ctx context.Context, msg *TaskMessage) error
func github.com/hibiken/asynq/internal/rdb.(*RDB).Requeue(ctx context.Context, msg *TaskMessage) error
func github.com/hibiken/asynq/internal/rdb.(*RDB).Retry(ctx context.Context, msg *TaskMessage, processAt time.Time, errMsg string, isFailure bool) error
func github.com/hibiken/asynq/internal/rdb.(*RDB).Schedule(ctx context.Context, msg *TaskMessage, processAt time.Time) error
func github.com/hibiken/asynq/internal/rdb.(*RDB).ScheduleUnique(ctx context.Context, msg *TaskMessage, processAt time.Time, ttl time.Duration) error
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.