diff --git a/couchpotato/core/plugins/scanner/main.py b/couchpotato/core/plugins/scanner/main.py index b822bc0f..fd43075a 100644 --- a/couchpotato/core/plugins/scanner/main.py +++ b/couchpotato/core/plugins/scanner/main.py @@ -11,6 +11,7 @@ from subliminal.videos import Video import enzyme import os import re +import threading import time import traceback @@ -388,6 +389,11 @@ class Scanner(Plugin): if on_found: on_found(group, total_found, total_found - len(processed_movies)) + # Wait for all the async events calm down a bit + while threading.activeCount() > 100 and not self.shuttingDown(): + log.debug('Too many threads active, waiting a few seconds') + time.sleep(10) + if len(processed_movies) > 0: log.info('Found %s movies in the folder %s', (len(processed_movies), folder)) else: