From 0536a7c1517d16f58acf21d6bcde8d572f7ac072 Mon Sep 17 00:00:00 2001 From: croneter Date: Mon, 5 Nov 2018 13:52:31 +0100 Subject: [PATCH] Don't spawn a separate full sync thread --- resources/lib/library_sync/full_sync.py | 6 +++--- resources/lib/sync.py | 24 +++++++++++------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/resources/lib/library_sync/full_sync.py b/resources/lib/library_sync/full_sync.py index c35cc0bd..c0aa09c9 100644 --- a/resources/lib/library_sync/full_sync.py +++ b/resources/lib/library_sync/full_sync.py @@ -20,7 +20,7 @@ else: LOG = getLogger('PLEX.sync.full_sync') -class FullSync(backgroundthread.KillableThread, common.libsync_mixin): +class FullSync(common.libsync_mixin): def __init__(self, repair, callback, show_dialog): """ repair=True: force sync EVERY item @@ -213,5 +213,5 @@ class FullSync(backgroundthread.KillableThread, common.libsync_mixin): def start(show_dialog, repair=False, callback=None): """ """ - # backgroundthread.BGThreader.addTask(FullSync().setup(repair, callback)) - FullSync(repair, callback, show_dialog).start() + # FullSync(repair, callback, show_dialog).start() + FullSync(repair, callback, show_dialog).run() diff --git a/resources/lib/sync.py b/resources/lib/sync.py index e03a5670..8e267c41 100644 --- a/resources/lib/sync.py +++ b/resources/lib/sync.py @@ -40,7 +40,7 @@ class Sync(backgroundthread.KillableThread): # Show sync dialog even if user deactivated? self.force_dialog = False # Lock used to wait on a full sync, e.g. on initial sync - self.lock = backgroundthread.threading.Lock() + # self.lock = backgroundthread.threading.Lock() super(Sync, self).__init__() def isCanceled(self): @@ -126,21 +126,19 @@ class Sync(backgroundthread.KillableThread): self.sync_successful = successful self.last_full_sync = utils.unix_timestamp() set_library_scan_toggle(boolean=False) - try: - self.lock.release() - except backgroundthread.threading.ThreadError: - pass + # try: + # self.lock.release() + # except backgroundthread.threading.ThreadError: + # pass def start_library_sync(self, show_dialog=None, repair=False, block=False): show_dialog = show_dialog if show_dialog is not None else state.SYNC_DIALOG - if block: - self.lock.acquire() - library_sync.start(show_dialog, repair, self.on_library_scan_finished) - # Will block until scan is finished - self.lock.acquire() - self.lock.release() - else: - library_sync.start(show_dialog, repair, self.on_library_scan_finished) + library_sync.start(show_dialog, repair, self.on_library_scan_finished) + # if block: + # self.lock.acquire() + # Will block until scan is finished + # self.lock.acquire() + # self.lock.release() def start_fanart_download(self, refresh): if not utils.settings('FanartTV') == 'true':