From ada337c2c42d12fbe6035bf8e4f90f33318d80cc Mon Sep 17 00:00:00 2001 From: croneter Date: Sun, 18 Jul 2021 15:41:10 +0200 Subject: [PATCH] Fix a racing condition that could lead to the sync getting stuck Fixup racing --- resources/lib/library_sync/fill_metadata_queue.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/resources/lib/library_sync/fill_metadata_queue.py b/resources/lib/library_sync/fill_metadata_queue.py index 0f27d783..a459b7af 100644 --- a/resources/lib/library_sync/fill_metadata_queue.py +++ b/resources/lib/library_sync/fill_metadata_queue.py @@ -46,6 +46,10 @@ class FillMetadataQueue(common.LibrarySyncMixin, if (not self.repair and plexdb.checksum(plex_id, section.plex_type) == checksum): continue + if not do_process_section: + do_process_section = True + self.processing_queue.add_section(section) + LOG.debug('Put section in processing queue: %s', section) try: self.get_metadata_queue.put((count, plex_id, section), timeout=QUEUE_TIMEOUT) @@ -54,11 +58,8 @@ class FillMetadataQueue(common.LibrarySyncMixin, 'aborting sync now', plex_id) section.sync_successful = False break - count += 1 - if not do_process_section: - do_process_section = True - self.processing_queue.add_section(section) - LOG.debug('Put section in processing queue: %s', section) + else: + count += 1 # We might have received LESS items from the PMS than anticipated. # Ensures that our queues finish section.number_of_items = count