atproto made easy crates.io/crates/jacquard
atproto rust

Rate limit support #3m6lefpjzsm22

Closed opened by olaren.dev
·

Please correct me if I'm wrong, but I haven't seen code for handling rate limiting. I think it would be a great feature if jacquard respected the rate-limit headers by default.

My use case right now is listing all the follows of a specific user and some users have a lot of follows (10k+). At a rate of 100 follows/request, respecting the rate-limiting becomes a legitimate concern

Thanks!

Delete this issue?

This cannot be undone.

nonbinary.computer
·

Do you have a suggested or preferred way for the library to present that option? It would definitely be a good convenience feature for sure. the challenge is that the actual rate limits for requests aren't actually specified in the lexicons. would need to parse the headers, i believe and then adapt behaviour based on that. an alternative would be to expose those headers in the response struct like i do the status code, and then you'd have the information to use as you wish.

Login to leave a reply

Delete comment?

This cannot be undone.

olaren.dev
·

What could get tricky here is that different devs could want different behaviours. For example, in my use case, the best action would be to throttle the requests depending on the previous request's headers. However, for another use case, it might be better to show an error to the user.

I think that surfacing the headers in the request struct would be tge leaner way of doing it without assuming too many things

nonbinary.computer
·

yeah that aligns with my thoughts as well. I'll implement soon, then.

finally getting around to passing through the headers in the response and errors properly

Login to leave a reply

Delete comment?

This cannot be undone.

main now exposes the headers in the response and error paths. Needing them for Jetstream v2 made me remember I'd been neglecting this.

Login to leave a reply

Delete comment?

This cannot be undone.

Sign up or Login to add to the discussion.