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:
+2
-1
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user