How hcksyg-27/myleetcode works
This is a small in-memory rate-limiting library for an LLM API gateway. A caller submits a client and resource to allow; the limiter retrieves isolated state, dispatches to the configured sliding-window or token-bucket algorithm, and returns an allow decision with remaining capacity and, on rejection, a retry estimate. The source confirms these calls and the use of the system clock. Both algorithms share one implementation file; no separate gateway or persistent storage is present.
Main entry points: rate_limiter.py Request Decision
Components 7
Other components
- API Caller
- Request Decision
rate_limiter.py - State Lookup
rate_limiter.py - Per-Client State
rate_limiter.py - Sliding Window
rate_limiter.py - Token Bucket
rate_limiter.py - System Clock
Connections 7
- API Caller → Request Decision: submits request
README.md - Request Decision → State Lookup: gets state
rate_limiter.py - State Lookup → Per-Client State: reads or creates
rate_limiter.py - Request Decision → Sliding Window: dispatches to
rate_limiter.py - Request Decision → Token Bucket: dispatches to
rate_limiter.py - Sliding Window → System Clock: reads time
rate_limiter.py - Token Bucket → System Clock: reads time
rate_limiter.py