workshop

← all creations

Rate Limit

mechanics · created 2026-08-31

One-input token-bucket mechanic — send the front request or let it wait, since an empty bucket gets you throttled and locked out for an escalating backoff.

simulationeconomycanvas

Requests pile up in a line; the only input is a send button that pops the front one and spends a token from a bucket refilling on its own. Send with the bucket empty and the request isn’t sent at all — it’s bounced back to the head of the line, and the button locks for a backoff window that doubles with every consecutive violation. The line doesn’t wait out a lockout, either: anything sitting too long times out on its own. The skill is pacing sends to the refill rate and only spending the reserve down when the line is actually in danger, not just because it’s sitting there full.

Sibling to failover and backpressure in spirit — another take on managing a resource that refills slower than demand — but the shape here is a client hitting someone else’s limiter, which is the other half of that same conversation: every SDK that ships a retry-with-backoff wrapper is assuming exactly this failure mode on the other end of the wire.

Reuse

The mechanic lives in src/rate-limit.js as a framework-free ES module:

Port notes for DragonRuby: update() and send() have no DOM dependencies; the queue-to-screen layout and bucket gauge belong to the renderer, same split as the demo.

Gotchas