chroma: set a default timeout of 10 seconds

TODO: Configurable timeouts :)
This commit is contained in:
Rebecca Turner 2025-07-27 22:37:33 -07:00
parent 52cf74125e
commit 1786adfff1
2 changed files with 6 additions and 2 deletions

View file

@ -98,7 +98,9 @@ def acoustid_match(log, path):
fp = fp.decode()
_fingerprints[path] = fp
try:
res = acoustid.lookup(API_KEY, fp, duration, meta="recordings releases")
res = acoustid.lookup(
API_KEY, fp, duration, meta="recordings releases", timeout=10
)
except acoustid.AcoustidError as exc:
log.debug(
"fingerprint matching {0} failed: {1}",
@ -292,7 +294,7 @@ def submit_items(log, userkey, items, chunksize=64):
"""Submit the current accumulated fingerprint data."""
log.info("submitting {0} fingerprints", len(data))
try:
acoustid.submit(API_KEY, userkey, data)
acoustid.submit(API_KEY, userkey, data, timeout=10)
except acoustid.AcoustidError as exc:
log.warning("acoustid submission error: {0}", exc)
del data[:]

View file

@ -57,6 +57,8 @@ Bug fixes:
:bug:`5699`
* :doc:`plugins/discogs`: Beets will no longer crash if a release has been
deleted, and returns a 404.
* :doc:`plugins/chroma`: AcoustID lookup HTTP requests will now time out after
10 seconds, rather than hanging the entire import process.
For packagers: