advplyr / audiobookshelf

Self-hosted audiobook and podcast server
https://audiobookshelf.org
GNU General Public License v3.0
5.42k stars 375 forks source link

[Bug]: Authors → Match All Authors is resulting in a 429 Error from api.audnex.us, needs to be rate limited, possible warning message #2931

Closed ZLoth closed 1 week ago

ZLoth commented 1 week ago

Describe the issue

In some of my AudioBookShelf library, I have hundreds of authors. When I attempt to do an author match using Authors → Match All Authors, I get a match on some authors, but errors on others, including well-known authors. A rescan results in some of those missed authors being matched up. When I review the servers logs, I see the following:

2024-05-05 12:44:57.626 - INFO - [Audnexus] Searching for author "https://api.audnex.us/authors/B004AIN4W4?region=us"
2024-05-05 12:44:57.705 - ERROR - [Audnexus] Author request failed for B004AIN4W4 AxiosError: Request failed with status code 429
2024-05-05 12:44:57.730 - INFO - [Audnexus] Searching for author "https://api.audnex.us/authors?name=David+Javerbaum&region=us"
2024-05-05 12:44:57.821 - ERROR - [Audnexus] Author ASIN request failed for David Javerbaum AxiosError: Request failed with status code 429
2024-05-05 12:44:58.060 - DEBUG - [Audnexus] Looking up author by name Day Keene
2024-05-05 12:44:58.061 - INFO - [Audnexus] Searching for author "https://api.audnex.us/authors?name=Day+Keene&region=us"
2024-05-05 12:44:58.133 - ERROR - [Audnexus] Author ASIN request failed for Day Keene AxiosError: Request failed with status code 429

This tells me that AudioBookShelf is sending too many requests to api.audnex.us within a short period of time and needs to slow down and be rate limited to maybe one request every .25 to .5 seconds. Having author's being matched up is not a time-critical function, and waiting several minutes for the matching to complete should not be an unexpected condition. It may warrant a warning message when the administrator clicks on the Match All Authors that it may take some time to complete.

Screenshot from logs screen: image

Steps to reproduce the issue

  1. Go to a library with large number of authors
  2. Go to Authors
  3. Click on March All Authors
  4. Wait until red error messages appear.
  5. Go to Settings → Logs
  6. Filter for Warn-level messages

Audiobookshelf version

2.9.0

How are you running audiobookshelf?

Docker

nichwall commented 1 week ago

Duplicate of https://github.com/advplyr/audiobookshelf/issues/1570