fix(webhook): treat HTTP 409 (rebuild already running) as success, not error
The pmtiles-webhook returns 409 when a rebuild is already in progress. Previously this was treated as a failure, showing 'Webhook PMTiles indisponibil' error to the user. Now 409 is handled as a valid state with appropriate messaging. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -161,13 +161,15 @@ export default function MonitorPage() {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ action: "rebuild" }),
|
||||
});
|
||||
const result = await res.json() as { ok?: boolean; error?: string; previousPmtiles?: { lastModified: string }; webhookStatus?: number };
|
||||
const result = await res.json() as { ok?: boolean; error?: string; alreadyRunning?: boolean; previousPmtiles?: { lastModified: string } };
|
||||
if (!result.ok) {
|
||||
addLog("error", result.error ?? "Eroare necunoscuta");
|
||||
setActionLoading("");
|
||||
return;
|
||||
}
|
||||
addLog("ok", `Webhook trimis (HTTP ${result.webhookStatus}). Rebuild in curs...`);
|
||||
addLog("ok", result.alreadyRunning
|
||||
? "Rebuild deja in curs. Se monitorizeaza..."
|
||||
: "Webhook trimis. Rebuild pornit...");
|
||||
rebuildPrevRef.current = result.previousPmtiles?.lastModified ?? null;
|
||||
// Poll every 15s to check if PMTiles was updated
|
||||
if (pollRef.current) clearInterval(pollRef.current);
|
||||
|
||||
Reference in New Issue
Block a user