From 1786adfff125c4e1f66b6658beef0b0cbfe4c847 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Sun, 27 Jul 2025 22:37:33 -0700 Subject: [PATCH] chroma: set a default timeout of 10 seconds TODO: Configurable timeouts :) --- beetsplug/chroma.py | 6 ++++-- docs/changelog.rst | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/beetsplug/chroma.py b/beetsplug/chroma.py index f90877113..3b31382b7 100644 --- a/beetsplug/chroma.py +++ b/beetsplug/chroma.py @@ -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[:] diff --git a/docs/changelog.rst b/docs/changelog.rst index 75a11956b..b180be34f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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: