diff --git a/django_rq/management/commands/rqworker.py b/django_rq/management/commands/rqworker.py index c973af55..61373cf6 100644 --- a/django_rq/management/commands/rqworker.py +++ b/django_rq/management/commands/rqworker.py @@ -47,6 +47,8 @@ def add_arguments(self, parser): help='Turns debug mode on or off.') parser.add_argument('--max-jobs', action='store', default=None, dest='max_jobs', type=int, help='Maximum number of jobs to execute') + parser.add_argument('--max-idle-time', action='store', default=None, dest='max_idle_time', type=int, + help='Seconds to wait for job before shutting down') parser.add_argument('--serializer', action='store', default='rq.serializers.DefaultSerializer', dest='serializer', help='Specify a custom Serializer.') parser.add_argument('args', nargs='*', type=str, @@ -93,7 +95,7 @@ def handle(self, *args, **options): w.work( burst=options.get('burst', False), with_scheduler=options.get('with_scheduler', False), - logging_level=level, max_jobs=options['max_jobs'] + logging_level=level, max_jobs=options['max_jobs'], max_idle_time=options['max_idle_time'] ) except ConnectionError as e: self.stderr.write(str(e))