From d627662038dca8281bcb25e52f884f83a7d40f12 Mon Sep 17 00:00:00 2001 From: Ruud Date: Sun, 22 Apr 2012 16:18:23 +0200 Subject: [PATCH] Don't run multiple searches at once --- couchpotato/core/plugins/searcher/main.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/couchpotato/core/plugins/searcher/main.py b/couchpotato/core/plugins/searcher/main.py index 030e5459..d0f44202 100644 --- a/couchpotato/core/plugins/searcher/main.py +++ b/couchpotato/core/plugins/searcher/main.py @@ -16,6 +16,8 @@ log = CPLog(__name__) class Searcher(Plugin): + in_progress = False + def __init__(self): addEvent('searcher.all', self.all_movies) addEvent('searcher.single', self.single) @@ -27,6 +29,12 @@ class Searcher(Plugin): def all_movies(self): + if self.in_progress: + log.info('Search already in progress') + return + + self.in_progress = True + db = get_session() movies = db.query(Movie).filter( @@ -52,6 +60,8 @@ class Searcher(Plugin): if self.shuttingDown(): break + self.in_progress = False + def single(self, movie): available_status = fireEvent('status.get', 'available', single = True)