roma-glushko / hyx

🧘‍♀️ Lightweight fault tolerant primitives for your modern asyncio Python microservices

Home Page:https://hyx.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expose ToketBucket as a standalone component

roma-glushko opened this issue · comments

The hyx.ratelimit package provides TokenBucketLimiter component:

class TokenBucketLimiter(RateLimiter):

Its API is rather simplistic and hard to reuse if you want to pull that bucket logic to reuse somewhere (for example, to implement a custom bucket retry).

Let's refactor the TokenBucket logic out of the ratelimiter and expose it outside of Hyx, so other projects could import it.