feat(web): retry a needs-attention job from The Floor
Add POST /api/requests/[id]/retry: 404 if the request/job is missing, 400 if the job isn't in needs_attention, otherwise clears the job's stale candidates and resets it to state=requested/currentStage=intake (error/claimedAt cleared) plus request status=pending, in a transaction, so the worker's requested-only claim re-picks it up. Wire a Retry button into the attention-row note on the Floor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+16
-4
@@ -72,6 +72,14 @@ export function Queue() {
|
||||
return () => clearInterval(id);
|
||||
}, []);
|
||||
|
||||
async function retry(id: string) {
|
||||
const res = await fetch(`/api/requests/${id}/retry`, { method: "POST" });
|
||||
if (res.ok) {
|
||||
toast("Retrying…");
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
async function submit(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
if (!artist.trim() || !album.trim()) return;
|
||||
@@ -149,10 +157,14 @@ export function Queue() {
|
||||
meta = undefined;
|
||||
}
|
||||
|
||||
const note = attention
|
||||
? j.error?.trim() ||
|
||||
"No source met the quality cutoff, or the pipeline stalled. Retry the request, or lower the cutoff for this release."
|
||||
: undefined;
|
||||
const note = attention ? (
|
||||
<>
|
||||
{j.error?.trim() || "No source met the quality cutoff, or the pipeline stalled."}{" "}
|
||||
<button className="btn sm" onClick={() => retry(r.id)}>
|
||||
Retry
|
||||
</button>
|
||||
</>
|
||||
) : undefined;
|
||||
|
||||
const stageLabel =
|
||||
attention || j.state === "matching" || j.state === "matched" ? undefined : j.currentStage;
|
||||
|
||||
Reference in New Issue
Block a user