From e2f89b3171aef3cd0d4bd946e181a94b5b0a7904 Mon Sep 17 00:00:00 2001 From: Samuel Colvin Date: Sat, 4 Jun 2016 13:31:07 +0100 Subject: [PATCH] fix for python 2.6 --- rq/worker.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rq/worker.py b/rq/worker.py index 6c63d112..c9fe4b4a 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -730,6 +730,8 @@ class HerokuWorker(Worker): Note: coverage doesn't work inside the forked thread so code expected to be processed there has pragma: no cover """ imminent_shutdown_delay = 8 + frame_properties = ['f_code', 'f_exc_traceback', 'f_exc_type', 'f_exc_value', 'f_lasti', 'f_lineno', 'f_locals', + 'f_restricted', 'f_trace'] def main_work_horse(self, job, queue): """Modified entry point which ignores SIGINT and SIGTERM and only handles SIGRTMIN""" @@ -786,9 +788,7 @@ class HerokuWorker(Worker): signal.signal(signal.SIGALRM, self.force_shutdown) signal.alarm(self.imminent_shutdown_delay) - @staticmethod - def force_shutdown(signum, frame): - info = {attr: getattr(frame, attr) for attr in ['f_code', 'f_exc_traceback', 'f_exc_type', 'f_exc_value', - 'f_lasti', 'f_lineno', 'f_locals', 'f_restricted', 'f_trace']} + def force_shutdown(self, signum, frame): + info = dict((attr, getattr(frame, attr)) for attr in self.frame_properties) logger.warn('raising ShutDownImminentException to cancel job...') raise ShutDownImminentException('shut down imminent (signal: %s)' % signal_name(signum), info)