Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Completed ¶
type Completed struct {
// ID is the Task ID
ID string
// Queue is the name of the queue this Task belongs to.
Queue string
// Task is the task data.
Task []byte
// Attempts are the amount of times this Task was executed.
Attempts int
// Succeeded indicates if the Task execution was a success.
Succeeded bool
// LastDuration is the last execution duration.
LastDuration time.Duration
// ExpiresAt is when this record should be removed from the database.
// If omitted, the record should not be removed.
ExpiresAt *time.Time
// CreatedAt is when the Task was originally created.
CreatedAt time.Time
// LastExecutedAt is the last time this Task executed.
LastExecutedAt time.Time
// Error is the error message provided by the Task processor.
Error *string
}
Completed is a completed task.
type CompletedTasks ¶
type CompletedTasks []*Completed
CompletedTasks contains multiple completed tasks.
func GetCompletedTasks ¶
func GetCompletedTasks(ctx context.Context, db *sql.DB, query string, args ...any) (CompletedTasks, error)
GetCompletedTasks loads completed tasks from the database using a given query and arguments.
type Task ¶
type Task struct {
// ID is the Task ID
ID string
// Queue is the name of the queue this Task belongs to.
Queue string
// Task is the task data.
Task []byte
// Attempts are the amount of times this Task was executed.
Attempts int
// WaitUntil is the time the task should not be executed until.
WaitUntil *time.Time
// CreatedAt is when the Task was originally created.
CreatedAt time.Time
// LastExecutedAt is the last time this Task executed.
LastExecutedAt *time.Time
// ClaimedAt is the time this Task was claimed for execution.
ClaimedAt *time.Time
}
Task is a task that is queued for execution.
type Tasks ¶
type Tasks []*Task
Tasks are a slice of tasks.
func GetScheduledTasks ¶
func GetScheduledTasks(ctx context.Context, db *sql.DB, deadline time.Time, limit int) (Tasks, error)
GetScheduledTasks loads the tasks that are next up to be executed in order of execution time. It's important to note that this does not filter out tasks that are not yet ready based on their wait time. The deadline provided is used to include tasks that have been claimed if that given amount of time has elapsed.
Click to show internal directories.
Click to hide internal directories.