From e118c73aa36506e1f66eda027aedfdda98758821 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Thu, 20 Dec 2012 19:01:04 +0100 Subject: [PATCH] spotify: Refactor loading timeout logic --- mopidy/backends/spotify/library.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mopidy/backends/spotify/library.py b/mopidy/backends/spotify/library.py index 28e9c61f..bde1e3fb 100644 --- a/mopidy/backends/spotify/library.py +++ b/mopidy/backends/spotify/library.py @@ -103,10 +103,10 @@ class SpotifyLibraryProvider(base.BaseLibraryProvider): self, spotify_obj, timeout=settings.SPOTIFY_TIMEOUT): # XXX Sleeping to wait for the Spotify object to load is an ugly hack, # but it works. We should look into other solutions for this. - start = time.time() + wait_until = time.time() + timeout while not spotify_obj.is_loaded(): time.sleep(0.1) - if time.time() > (start + timeout): + if time.time() > wait_until: logger.debug( 'Timeout: Spotify object did not load in %ds', timeout) return