twilight-rs / twilight

Powerful, flexible, and scalable ecosystem of Rust libraries for the Discord API.
https://discord.gg/twilight-rs
ISC License
676 stars 132 forks source link

Wrong bucket on ratelimiter #1046

Open Learath2 opened 3 years ago

Learath2 commented 3 years ago

I'm hitting a 429 on a create_reaction following a delete_all_reactions. Twilight puts these in two separate buckets ChannelsIdMessagesIdReactions(i) and ChannelsIdMessagesIdReactionsUserIdType(i). However testing reveals discord uses the same bucket.

Don't think it's pertinent here but I'm on Linux, and the only feature flag I'm using is tracing on twilight-http.

Minimal testcase: https://paste.pr0.tips/f1?rust Result: result

I didn't include it here but I've verified that the 3 requests all have the same x-ratelimit-bucket.

I also wanted to inquire about the possibility to use x-ratelimit-bucket to create our buckets instead of trying to guess them. I don't really see any issues with dynamically creating the buckets on responses except ones that are also present in the current solution. If there isn't a specific reason we aren't using these I could try to provide an implementation.

7596ff commented 3 years ago

Thank you for the detailed issue!