feat(tasks): offer Mark as Idle for cancelled tasks
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
d8f78056c1
commit
3fab4016f7
@@ -677,10 +677,14 @@ public sealed class WorkerHub : Microsoft.AspNetCore.SignalR.Hub
|
||||
throw new HubException("Cannot change the status of a running task. Cancel it first.");
|
||||
|
||||
// Queueing goes through the gated transition so draft subtasks can't be queued;
|
||||
// Idle goes through ResetToIdleAsync so StartedAt/FinishedAt/Result are cleared;
|
||||
// other statuses keep the unconditional "set status freely" affordance.
|
||||
var result = parsed == TaskStatus.Queued
|
||||
? await _state.EnqueueAsync(taskId, Context.ConnectionAborted)
|
||||
: await _state.ForceSetStatusAsync(taskId, parsed, Context.ConnectionAborted);
|
||||
var result = parsed switch
|
||||
{
|
||||
TaskStatus.Queued => await _state.EnqueueAsync(taskId, Context.ConnectionAborted),
|
||||
TaskStatus.Idle => await _state.ResetToIdleAsync(taskId, Context.ConnectionAborted),
|
||||
_ => await _state.ForceSetStatusAsync(taskId, parsed, Context.ConnectionAborted),
|
||||
};
|
||||
if (!result.Ok) throw new HubException(result.Reason ?? "set status failed");
|
||||
return new SetTaskStatusResultDto(
|
||||
result.BaseDirty is { } w ? new BaseDirtyWarningDto(w.ModifiedCount, w.UntrackedCount) : null);
|
||||
|
||||
Reference in New Issue
Block a user