rafalopilowski1 / djSonic

WIP Discord bot written in Rust for playing music from SubSonic API (supporting FunkWhale)
2 stars 0 forks source link

Handle rate limiting in FunkWhale #32

Open rafalopilowski1 opened 2 years ago

rafalopilowski1 commented 2 years ago

Quoting API docs (https://docs.funkwhale.audio/swagger/):

Header Example value Description value
X-RateLimit-Limit 50 The number of allowed requests whithin a given period
X-RateLimit-Duration 3600 The time window, in seconds, during which those requests are accounted for.
X-RateLimit-Scope login The name of the scope as computed for the request
X-RateLimit-Remaining 42 How many requests can be sent with the same scope before the limit applies
Retry-After (if X-RateLimit-Remaining is 0) 3543 How many seconds to wait before a retry
X-RateLimit-Reset 1568126089 A timestamp indicating when X-RateLimit-Remaining will return to its higher possible value
X-RateLimit-ResetSeconds 3599 How many seconds to wait before X-RateLimit-Remaining returns to its higher possible value