2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-11-10 11:31:58 +08:00

Add LastFailedAt to TaskInfo

This commit is contained in:
Ken Hibino 2021-05-18 21:03:04 -07:00
parent 87264b66f3
commit cd351d49b9

View File

@ -81,6 +81,10 @@ func (info *TaskInfo) Retried() int { return info.msg.Retried }
// If the task has no failures, returns an empty string. // If the task has no failures, returns an empty string.
func (info *TaskInfo) LastErr() string { return info.msg.ErrorMsg } func (info *TaskInfo) LastErr() string { return info.msg.ErrorMsg }
// LastFailedAt returns the time of the last failure if any.
// If the task has no failures, returns zero time.
func (info *TaskInfo) LastFailedAt() time.Time { return time.Unix(info.msg.LastFailedAt, 0) }
// Timeout returns the duration the task can be processed by Handler before being retried, // Timeout returns the duration the task can be processed by Handler before being retried,
// zero if not specified // zero if not specified
func (info *TaskInfo) Timeout() time.Duration { func (info *TaskInfo) Timeout() time.Duration {