From 087ee4288246b6586f5ab0fcd916e81bfeda9137 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Sun, 16 Aug 2015 12:06:14 +0200 Subject: [PATCH] audio: Fix scan timeout handling --- docs/changelog.rst | 3 +++ mopidy/audio/scan.py | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index c7f1aeee..290806d3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -21,6 +21,9 @@ Bug fix release. with a limited set of environment variables. (Fixes: :issue:`1249`, PR: :issue:`1255`) +- Audio: Fix timeout handling in scanner. This regression caused timeouts to + expire before it should, causing scans to fail. + v1.1.0 (2015-08-09) =================== diff --git a/mopidy/audio/scan.py b/mopidy/audio/scan.py index cf370052..13c76d52 100644 --- a/mopidy/audio/scan.py +++ b/mopidy/audio/scan.py @@ -139,7 +139,7 @@ def _process(pipeline, timeout_ms): types = (gst.MESSAGE_ELEMENT | gst.MESSAGE_APPLICATION | gst.MESSAGE_ERROR | gst.MESSAGE_EOS | gst.MESSAGE_ASYNC_DONE | gst.MESSAGE_TAG) - start = clock.get_time() + previous = clock.get_time() while timeout > 0: message = bus.timed_pop_filtered(timeout, types) @@ -171,7 +171,9 @@ def _process(pipeline, timeout_ms): # Note that this will only keep the last tag. tags.update(utils.convert_taglist(taglist)) - timeout -= clock.get_time() - start + now = clock.get_time() + timeout -= now - previous + previous = now raise exceptions.ScannerError('Timeout after %dms' % timeout_ms)