mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-19 03:05:53 +08:00
Show orphaned status in active task table
This commit is contained in:
parent
1655bf3d88
commit
aceac82d78
@ -247,6 +247,9 @@ type activeTask struct {
|
|||||||
// Value is either time formatted in RFC3339 format, or "-" which indicates that
|
// Value is either time formatted in RFC3339 format, or "-" which indicates that
|
||||||
// the data is not available yet.
|
// the data is not available yet.
|
||||||
Deadline string `json:"deadline"`
|
Deadline string `json:"deadline"`
|
||||||
|
|
||||||
|
// IsOrphaned indicates whether the task is left in active state with no worker processing it.
|
||||||
|
IsOrphaned bool `json:"is_orphaned"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func toActiveTask(ti *asynq.TaskInfo, pf PayloadFormatter) *activeTask {
|
func toActiveTask(ti *asynq.TaskInfo, pf PayloadFormatter) *activeTask {
|
||||||
@ -259,7 +262,7 @@ func toActiveTask(ti *asynq.TaskInfo, pf PayloadFormatter) *activeTask {
|
|||||||
Retried: ti.Retried,
|
Retried: ti.Retried,
|
||||||
LastError: ti.LastErr,
|
LastError: ti.LastErr,
|
||||||
}
|
}
|
||||||
return &activeTask{baseTask: base}
|
return &activeTask{baseTask: base, IsOrphaned: ti.IsOrphaned}
|
||||||
}
|
}
|
||||||
|
|
||||||
func toActiveTasks(in []*asynq.TaskInfo, pf PayloadFormatter) []*activeTask {
|
func toActiveTasks(in []*asynq.TaskInfo, pf PayloadFormatter) []*activeTask {
|
||||||
|
@ -290,6 +290,7 @@ export interface TaskInfo {
|
|||||||
completed_at: string;
|
completed_at: string;
|
||||||
result: string;
|
result: string;
|
||||||
ttl_seconds: number;
|
ttl_seconds: number;
|
||||||
|
is_orphaned: boolean; // Only applies to task.state == 'active'
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ServerInfo {
|
export interface ServerInfo {
|
||||||
|
@ -347,9 +347,19 @@ function Row(props: RowProps) {
|
|||||||
{prettifyPayload(task.payload)}
|
{prettifyPayload(task.payload)}
|
||||||
</SyntaxHighlighter>
|
</SyntaxHighlighter>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>{task.canceling ? "Canceling" : "Running"}</TableCell>
|
|
||||||
<TableCell>
|
<TableCell>
|
||||||
{task.start_time === "-" ? "just now" : timeAgo(task.start_time)}
|
{task.canceling
|
||||||
|
? "Canceling"
|
||||||
|
: task.is_orphaned
|
||||||
|
? "Orphaned"
|
||||||
|
: "Running"}
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
{task.is_orphaned
|
||||||
|
? "-"
|
||||||
|
: task.start_time === "-"
|
||||||
|
? "just now"
|
||||||
|
: timeAgo(task.start_time)}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
{task.deadline === "-" ? "-" : durationBefore(task.deadline)}
|
{task.deadline === "-" ? "-" : durationBefore(task.deadline)}
|
||||||
@ -365,7 +375,9 @@ function Row(props: RowProps) {
|
|||||||
<Tooltip title="Cancel">
|
<Tooltip title="Cancel">
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={props.onCancelClick}
|
onClick={props.onCancelClick}
|
||||||
disabled={task.requestPending || task.canceling}
|
disabled={
|
||||||
|
task.requestPending || task.canceling || task.is_orphaned
|
||||||
|
}
|
||||||
size="small"
|
size="small"
|
||||||
>
|
>
|
||||||
<CancelIcon fontSize="small" />
|
<CancelIcon fontSize="small" />
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "react",
|
"jsx": "react-jsx",
|
||||||
"noFallthroughCasesInSwitch": true
|
"noFallthroughCasesInSwitch": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
|
Loading…
Reference in New Issue
Block a user