From 828763317a86cedfe148681da21c3e30a7cc648b Mon Sep 17 00:00:00 2001 From: Ollie Walsh Date: Mon, 2 Dec 2013 11:38:02 +0000 Subject: [PATCH] Fix issue #8941 --- salt/utils/schedule.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/salt/utils/schedule.py b/salt/utils/schedule.py index 9552774f7b..eedd0ffe0f 100644 --- a/salt/utils/schedule.py +++ b/salt/utils/schedule.py @@ -243,15 +243,17 @@ class Schedule(object): 'job {0}, defaulting to 1.'.format(job)) data['maxrunning'] = 1 - if self.opts.get('multiprocessing', True): - thread_cls = multiprocessing.Process - else: - thread_cls = threading.Thread - proc = thread_cls(target=self.handle_func, args=(func, data)) - proc.start() - if self.opts.get('multiprocessing', True): - proc.join() - self.intervals[job] = int(time.time()) + try: + if self.opts.get('multiprocessing', True): + thread_cls = multiprocessing.Process + else: + thread_cls = threading.Thread + proc = thread_cls(target=self.handle_func, args=(func, data)) + proc.start() + if self.opts.get('multiprocessing', True): + proc.join() + finally: + self.intervals[job] = int(time.time()) def clean_proc_dir(opts):