mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-19 03:05:53 +08:00
Add retry and last error fields to all task types
This commit is contained in:
parent
a488599ec0
commit
3c43624927
@ -88,6 +88,9 @@ type BaseTask struct {
|
||||
Type string `json:"type"`
|
||||
Payload asynq.Payload `json:"payload"`
|
||||
Queue string `json:"queue"`
|
||||
MaxRetry int `json:"max_retry"`
|
||||
Retried int `json:"retried"`
|
||||
LastError string `json:"error_message"`
|
||||
}
|
||||
|
||||
type ActiveTask struct {
|
||||
@ -107,6 +110,9 @@ func toActiveTask(t *asynq.ActiveTask) *ActiveTask {
|
||||
Type: t.Type,
|
||||
Payload: t.Payload,
|
||||
Queue: t.Queue,
|
||||
MaxRetry: t.MaxRetry,
|
||||
Retried: t.Retried,
|
||||
LastError: t.LastError,
|
||||
}
|
||||
return &ActiveTask{BaseTask: base}
|
||||
}
|
||||
@ -130,6 +136,9 @@ func toPendingTask(t *asynq.PendingTask) *PendingTask {
|
||||
Type: t.Type,
|
||||
Payload: t.Payload,
|
||||
Queue: t.Queue,
|
||||
MaxRetry: t.MaxRetry,
|
||||
Retried: t.Retried,
|
||||
LastError: t.LastError,
|
||||
}
|
||||
return &PendingTask{
|
||||
BaseTask: base,
|
||||
@ -157,6 +166,9 @@ func toScheduledTask(t *asynq.ScheduledTask) *ScheduledTask {
|
||||
Type: t.Type,
|
||||
Payload: t.Payload,
|
||||
Queue: t.Queue,
|
||||
MaxRetry: t.MaxRetry,
|
||||
Retried: t.Retried,
|
||||
LastError: t.LastError,
|
||||
}
|
||||
return &ScheduledTask{
|
||||
BaseTask: base,
|
||||
@ -177,9 +189,6 @@ type RetryTask struct {
|
||||
*BaseTask
|
||||
Key string `json:"key"`
|
||||
NextProcessAt time.Time `json:"next_process_at"`
|
||||
MaxRetry int `json:"max_retry"`
|
||||
Retried int `json:"retried"`
|
||||
ErrorMsg string `json:"error_message"`
|
||||
}
|
||||
|
||||
func toRetryTask(t *asynq.RetryTask) *RetryTask {
|
||||
@ -188,14 +197,14 @@ func toRetryTask(t *asynq.RetryTask) *RetryTask {
|
||||
Type: t.Type,
|
||||
Payload: t.Payload,
|
||||
Queue: t.Queue,
|
||||
MaxRetry: t.MaxRetry,
|
||||
Retried: t.Retried,
|
||||
LastError: t.LastError,
|
||||
}
|
||||
return &RetryTask{
|
||||
BaseTask: base,
|
||||
Key: t.Key(),
|
||||
NextProcessAt: t.NextProcessAt,
|
||||
MaxRetry: t.MaxRetry,
|
||||
Retried: t.Retried,
|
||||
ErrorMsg: t.ErrorMsg,
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,9 +219,6 @@ func toRetryTasks(in []*asynq.RetryTask) []*RetryTask {
|
||||
type ArchivedTask struct {
|
||||
*BaseTask
|
||||
Key string `json:"key"`
|
||||
MaxRetry int `json:"max_retry"`
|
||||
Retried int `json:"retried"`
|
||||
ErrorMsg string `json:"error_message"`
|
||||
LastFailedAt time.Time `json:"last_failed_at"`
|
||||
}
|
||||
|
||||
@ -222,13 +228,13 @@ func toArchivedTask(t *asynq.ArchivedTask) *ArchivedTask {
|
||||
Type: t.Type,
|
||||
Payload: t.Payload,
|
||||
Queue: t.Queue,
|
||||
MaxRetry: t.MaxRetry,
|
||||
Retried: t.Retried,
|
||||
LastError: t.LastError,
|
||||
}
|
||||
return &ArchivedTask{
|
||||
BaseTask: base,
|
||||
Key: t.Key(),
|
||||
MaxRetry: t.MaxRetry,
|
||||
Retried: t.Retried,
|
||||
ErrorMsg: t.ErrorMsg,
|
||||
LastFailedAt: t.LastFailedAt,
|
||||
}
|
||||
}
|
||||
|
@ -249,18 +249,27 @@ export interface ActiveTask extends BaseTask {
|
||||
id: string;
|
||||
queue: string;
|
||||
start_time: string;
|
||||
max_retry: number;
|
||||
retried: number;
|
||||
error_message: string;
|
||||
}
|
||||
|
||||
export interface PendingTask extends BaseTask {
|
||||
id: string;
|
||||
key: string;
|
||||
queue: string;
|
||||
max_retry: number;
|
||||
retried: number;
|
||||
error_message: string;
|
||||
}
|
||||
|
||||
export interface ScheduledTask extends BaseTask {
|
||||
id: string;
|
||||
key: string;
|
||||
queue: string;
|
||||
max_retry: number;
|
||||
retried: number;
|
||||
error_message: string;
|
||||
next_process_at: string;
|
||||
}
|
||||
|
||||
|
@ -392,21 +392,27 @@ function Row(props: RowProps) {
|
||||
<TableBody>
|
||||
<TableRow>
|
||||
<TableCell>Retry</TableCell>
|
||||
<TableCell align="right">2/25</TableCell>
|
||||
<TableCell align="right">
|
||||
{task.retried}/{task.max_retry}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell>Deadline</TableCell>
|
||||
<TableCell align="right">In 30s</TableCell>
|
||||
<TableCell>Last Error</TableCell>
|
||||
<TableCell align="right">
|
||||
{task.error_message.length > 0
|
||||
? task.error_message
|
||||
: "N/A"}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell className={classes.noBottomBorder}>
|
||||
Unique
|
||||
Deadline
|
||||
</TableCell>
|
||||
<TableCell
|
||||
align="right"
|
||||
className={classes.noBottomBorder}
|
||||
align="right"
|
||||
>
|
||||
5m30s remaining
|
||||
TODO: In 30s
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
|
Loading…
Reference in New Issue
Block a user