mirror of
https://github.com/hibiken/asynq.git
synced 2024-11-13 04:46:39 +08:00
Change TaskMessage Timeout and Deadline to int
* This change breaks existing tasks in Redis
This commit is contained in:
parent
5dddc35d7c
commit
0527b93432
@ -80,6 +80,8 @@ func NewTaskMessage(taskType string, payload map[string]interface{}) *base.TaskM
|
||||
Queue: base.DefaultQueueName,
|
||||
Retry: 25,
|
||||
Payload: payload,
|
||||
Timeout: 1800, // default timeout of 30 mins
|
||||
Deadline: 0, // no deadline
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,18 +89,20 @@ type TaskMessage struct {
|
||||
// ErrorMsg holds the error message from the last failure.
|
||||
ErrorMsg string
|
||||
|
||||
// Timeout specifies how long a task may run.
|
||||
// The string value should be compatible with time.Duration.ParseDuration.
|
||||
// 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 dead queue.
|
||||
//
|
||||
// Zero means no limit.
|
||||
Timeout string
|
||||
// Use zero to indicate no timeout.
|
||||
Timeout int
|
||||
|
||||
// Deadline specifies the deadline for the task.
|
||||
// Task won't be processed if it exceeded its deadline.
|
||||
// The string shoulbe be in RFC3339 format.
|
||||
// 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 dead queue.
|
||||
//
|
||||
// time.Time's zero value means no deadline.
|
||||
Deadline string
|
||||
// Use zero to indicate no deadline.
|
||||
Deadline int
|
||||
|
||||
// UniqueKey holds the redis key used for uniqueness lock for this task.
|
||||
//
|
||||
|
@ -121,7 +121,8 @@ func TestMessageEncoding(t *testing.T) {
|
||||
Queue: "default",
|
||||
Retry: 10,
|
||||
Retried: 0,
|
||||
Timeout: "0",
|
||||
Timeout: 1800,
|
||||
Deadline: 1692311100,
|
||||
},
|
||||
out: &TaskMessage{
|
||||
Type: "task1",
|
||||
@ -130,7 +131,8 @@ func TestMessageEncoding(t *testing.T) {
|
||||
Queue: "default",
|
||||
Retry: 10,
|
||||
Retried: 0,
|
||||
Timeout: "0",
|
||||
Timeout: 1800,
|
||||
Deadline: 1692311100,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user