Webhook: back off + retry on 429, and report the real status

Discord rate-limits a webhook after a burst of sends. _upload_to_webhook
now honours the 429 retry_after and retries (up to 4×), so a batch of
images goes through instead of failing. The frontend also reports the
webhook's actual status (j.status) — previously it showed the route's
200 ("Send failed: HTTP 200"), masking the real 429.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-23 21:06:12 +02:00
parent 245422878b
commit 6f5fe892da
2 changed files with 16 additions and 3 deletions
+2 -1
View File
@@ -37,7 +37,8 @@ async function sendToDiscord(node) {
});
const j = await r.json().catch(() => ({}));
if (j?.ok) toast("success", "Sent to Discord");
else toast("error", "Send failed: " + (j?.error || ("HTTP " + r.status)));
else if (j?.status === 429) toast("error", "Discord rate-limited the webhook — wait a moment and retry");
else toast("error", "Send failed: " + (j?.error || ("HTTP " + (j?.status ?? r.status))));
} catch (err) {
toast("error", "Send failed: " + err);
}