From 23522ac75effa06dcd4d66008c77b8abc22cf559 Mon Sep 17 00:00:00 2001 From: sfaulds Date: Mon, 14 Nov 2016 12:24:07 +1100 Subject: [PATCH] add some checking arround starting a new thread, it looks like some systems are slow to release resources and need some time so give them that time. --- resources/lib/artwork.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index 9e60d540..4cae9648 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -251,12 +251,25 @@ class Artwork(object): new_thread.set_host(self.xbmc_host, self.xbmc_port) new_thread.set_auth(self.xbmc_username, self.xbmc_password) - new_thread.start() - self.image_cache_threads.append(new_thread) - return + counter = 0 + worked = False + while counter < 10: + try: + new_thread.start() + worked = True + break + except: + counter = counter + 1 + xbmc.sleep(1000) + + if(worked): + self.image_cache_threads.append(new_thread) + return True + else: + return False else: log.info("Waiting for empty queue spot: %s", len(self.image_cache_threads)) - xbmc.sleep(50) + xbmc.sleep(100) def cache_texture(self, url): # Cache a single image url to the texture cache