From 6e243a129185f1e2556534bf1bb827dee2ab9b84 Mon Sep 17 00:00:00 2001 From: Ruud Date: Fri, 27 Jan 2012 11:49:18 +0100 Subject: [PATCH] Don't loop endlessly on shutdown/restart --- couchpotato/core/_base/_core/main.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/couchpotato/core/_base/_core/main.py b/couchpotato/core/_base/_core/main.py index 0f75a3bd..a4df60a6 100644 --- a/couchpotato/core/_base/_core/main.py +++ b/couchpotato/core/_base/_core/main.py @@ -70,17 +70,20 @@ class Core(Plugin): fireEvent('app.shutdown') - while 1: + loop = True + while loop: still_running = fireEvent('plugin.running') - brk = True + if len(still_running) == 0: + break + + log.debug('Still running: %s' % still_running) for running in still_running: running = list(set(running) - set(self.ignore_restart)) if len(running) > 0: log.info('Waiting on plugins to finish: %s' % running) - brk = False - - if brk: break + else: + loop = False time.sleep(1)