diff --git a/rq/worker.py b/rq/worker.py index f7c8c63..5de6403 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -60,12 +60,16 @@ _signames = dict((getattr(signal, signame), signame) def signal_name(signum): - # Hackety-hack-hack: is there really no better way to reverse lookup the - # signal name? If you read this and know a way: please provide a patch :) try: - return _signames[signum] + if sys.version_info[:2] >= (3, 5): + return signal.Signals(signum).name + else: + return _signames[signum] + except KeyError: return 'SIG_UNKNOWN' + except ValueError: + return 'SIG_UNKNOWN' WorkerStatus = enum(