Best way to handle external API rate limits globally

Hey I want to access an external api through my workers and it has a rate limit of 4 reqs a second, previously I used bottleneck and that worked great for me, but that doesn’t work in serverless environments and I’d prefer not to use redis. Is there a cloudflare option that helps manage this rate limit globally? Not just by region? I was looking at durable objects but just wanted to know if there was another way I was missing like maybe a nice package similar to bottleneck. Thanks!
1 Reply
Mitya
Mitya3w ago
I'd say DO all the way. You could track this sort of thing in a D1 database, but DO seems tailor-made for this sort of thing.

Did you find this page helpful?