beets-audible icon indicating copy to clipboard operation
beets-audible copied to clipboard

Use rate limit retry-after response header to set sleep duration

Open chancez opened this issue 1 year ago • 2 comments

When being rate limited, we get a retry-after header which tells us how long to wait before retrying, let's use it.

chancez avatar Aug 25 '24 17:08 chancez

Thanks for the PR.

When did you encounter being rate limited?

Neurrone avatar Sep 01 '24 04:09 Neurrone

@Neurrone I'm running beets with timid: yes and was iterating on a number of files that were being a bit stubborn and it was erroring out when trying to rename certain files (via use-as-is). This resulted in it re-querying a large number of books every time I restarted beets, because I believe beets still runs queries for books not yet processed. So it was kind of like:

  • beets import ...
  • try to fix the error on renaming
  • error + exit
  • beets import ...
  • try to fix the error on renaming

When doing this in a large directory of unimported books (about 100), it didn't take long to get rate limited before I ran into the rate limit.

chancez avatar Sep 03 '24 16:09 chancez