mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-18 19:19:28 +02:00
ListenBrainz: Harmonized code
This commit is contained in:
parent
bef482fd68
commit
1b5ea241b6
1 changed files with 2 additions and 3 deletions
|
@ -57,9 +57,8 @@ func NewClient(token string) Client {
|
||||||
)
|
)
|
||||||
client.SetRetryMaxWaitTime(time.Duration(1 * time.Minute))
|
client.SetRetryMaxWaitTime(time.Duration(1 * time.Minute))
|
||||||
client.SetRetryAfter(func(client *resty.Client, resp *resty.Response) (time.Duration, error) {
|
client.SetRetryAfter(func(client *resty.Client, resp *resty.Response) (time.Duration, error) {
|
||||||
resetIn, err := strconv.Atoi(resp.Header().Get("X-RateLimit-Reset-In"))
|
retryAfter, err := strconv.Atoi(resp.Header().Get("Retry-After"))
|
||||||
// fmt.Printf("R %v: %v, %v\n", resp.Request.URL, resetIn, err)
|
return time.Duration(retryAfter * int(time.Second)), err
|
||||||
return time.Duration(resetIn * int(time.Second)), err
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return Client{
|
return Client{
|
||||||
|
|
Loading…
Add table
Reference in a new issue