Skip to content

Commit 52dfd4a

Browse files
fix(relay): share the Cloudflare rate-limit pause across Worker isolates
The pause added for #16810 lived in each isolate, so every isolate had to hit a 429 itself before it backed off, and hundreds of them could keep the account at its limit. A 429 now records the pause in Postgres (relay_upstream_api_pauses), and each isolate rereads it at most every 5 s before calling Cloudflare. Reads and writes fail open. Refs #16810 Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent c4264fd commit 52dfd4a

7 files changed

Lines changed: 1921 additions & 179 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CREATE TABLE "relay_upstream_api_pauses" (
2+
"api" varchar(64) PRIMARY KEY,
3+
"paused_until_ms" bigint NOT NULL
4+
);

0 commit comments

Comments
 (0)