From e2f398be8001b409326d640ad551603468b80f17 Mon Sep 17 00:00:00 2001 From: David Bonner Date: Sun, 1 Jun 2014 21:53:01 -0400 Subject: [PATCH] fix --worker-ttl command line arg Make sure it's converted to an int, since the rest of the code expects it to be. Without this patch, trying to use that argument gets you something like this: (cogo)[dbonner@bonnervm18 syseng]$ rqworker --worker-ttl 86400 21:52:07 RQ worker started, version 0.4.6 Traceback (most recent call last): File "/opt/cogo/bin/rqworker", line 9, in load_entry_point('rq==0.4.6', 'console_scripts', 'rqworker')() File "/home/dbonner/src/github/rq/rq/scripts/rqworker.py", line 102, in main w.work(burst=args.burst) File "/home/dbonner/src/github/rq/rq/worker.py", line 354, in work timeout = None if burst else max(1, self.default_worker_ttl - 60) TypeError: unsupported operand type(s) for -: 'str' and 'int' --- rq/scripts/rqworker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rq/scripts/rqworker.py b/rq/scripts/rqworker.py index 01850dd..5a2b696 100644 --- a/rq/scripts/rqworker.py +++ b/rq/scripts/rqworker.py @@ -30,7 +30,7 @@ def parse_args(): parser.add_argument('--job-class', '-j', action='store', default='rq.job.Job', help='RQ Job class to use') parser.add_argument('--path', '-P', default='.', help='Specify the import path.') parser.add_argument('--results-ttl', default=None, help='Default results timeout to be used') - parser.add_argument('--worker-ttl', default=None, help='Default worker timeout to be used') + parser.add_argument('--worker-ttl', type=int, default=None, help='Default worker timeout to be used') parser.add_argument('--verbose', '-v', action='store_true', default=False, help='Show more output') parser.add_argument('--quiet', '-q', action='store_true', default=False, help='Show less output') parser.add_argument('--sentry-dsn', action='store', default=None, metavar='URL', help='Report exceptions to this Sentry DSN') # noqa