From 19641bd8979d7f215ffceb8efb3467fe39cf0a9a Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 20 Mar 2013 22:47:14 +0100 Subject: [PATCH] Give the scanner some rest when to many threads --- couchpotato/core/plugins/scanner/main.py | 6 ++++++ 1 file changed, 6 insertions(+) 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: