A better Rust ATProto crate

Rate limit support #22

open
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!

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.

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

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

sign up or login to add to the discussion
Labels

None yet.

assignee
nonbinary.computer
Participants 2
AT URI
at://did:plc:6if5m2yo6kroprmmency3gt5/sh.tangled.repo.issue/3m6lefpjzsm22