Inkline
Menu

Rate limiter: token bucket

Templates
Rate limiter — token bucket 7 items and 6 connections. yes no Request arrives Build key (user + route) Refill tokens since last call Tokens left? Take one token Forward to the API 429 Too Many Requests
Rate limiter: token bucket — preview
Flowchart

The decision each request goes through in a token-bucket limiter: build the key, refill, then take a token or answer 429.

What is inside

  • Refill before checking
  • One decision, two outcomes
Use this template

Opens in the playground, no account needed. Sign up to save it.

Show the Inkline text
diagram flow "Rate limiter — token bucket"
  start    req    "Request arrives"
  step     key    "Build key (user + route)"
  step     refill "Refill tokens since last call"
  decision left   "Tokens left?"
  step     take   "Take one token"
  end      allow  "Forward to the API"
  end      deny   "429 Too Many Requests"

  req -> key -> refill -> left
  left -> take : yes
  take -> allow
  left -> deny : no