~/boss / gate-keeper

Token bucket rate limiter

The Gatekeeper

Guard the server gate. Read the bucket: let each request through, or reject it.

Loading the fight…

How to beat it

Tokens drip into a bucket at a steady rate, up to a cap. Every request takes one token to pass; an empty bucket means rejected. Bursts are fine while tokens last, and the drip holds the average.

Now the real boss

Interviews ask for the code. Watch it run, then write it yourself, tested in Python, C++ or Java.

On your phone? Writing code is easier on a laptop: open bossfight.dev/problems/token-bucket there. Sign in with your email to keep your progress on every device.

More bosses

esc