Skip to content

Commit a677eb5

Browse files
committed
chroma: set a default timeout of 10 seconds
TODO: Configurable timeouts :)
1 parent 5beb3d1 commit a677eb5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

beetsplug/chroma.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ def acoustid_match(log, path):
9898
fp = fp.decode()
9999
_fingerprints[path] = fp
100100
try:
101-
res = acoustid.lookup(API_KEY, fp, duration, meta="recordings releases")
101+
res = acoustid.lookup(
102+
API_KEY, fp, duration, meta="recordings releases", timeout=10
103+
)
102104
except acoustid.AcoustidError as exc:
103105
log.debug(
104106
"fingerprint matching {0} failed: {1}",
@@ -292,7 +294,7 @@ def submit_chunk():
292294
"""Submit the current accumulated fingerprint data."""
293295
log.info("submitting {0} fingerprints", len(data))
294296
try:
295-
acoustid.submit(API_KEY, userkey, data)
297+
acoustid.submit(API_KEY, userkey, data, timeout=10)
296298
except acoustid.AcoustidError as exc:
297299
log.warning("acoustid submission error: {0}", exc)
298300
del data[:]

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ Bug fixes:
5555
e.g. non latin characters as 盗作. If you want to keep the legacy behavior
5656
set the config option ``spotify.search_query_ascii: yes``.
5757
:bug:`5699`
58+
* :doc:`plugins/chroma`: AcoustID lookup HTTP requests will now time out after
59+
10 seconds, rather than hanging the entire import process.
5860

5961
For packagers:
6062

0 commit comments

Comments
 (0)