Build a Rate Limiter With Delivery Tracking

Problem Build a per-account rate limiter for an outbound messaging API: each account may send at most a fixed rate (e.g. 5 messages/second), and sends beyond that are throttled or queued. Alongside the limiter, track the delivery status of every message as it moves through queued → sent → delivered/failed.

Input / Output

  • Input: send requests keyed by account id, arriving concurrently over time.
  • Output: an accept/throttle decision per send, plus the current status of any message.

Constraints

  • Many accounts, each with an independent limit.
  • Concurrent sends to the same account must not exceed the limit.

Example

  • Limit 5 msg/sec/account; the 6th message in the same second is throttled or queued.
added …
LeaderboardSalaryAccount