From abac4a5f41efe6c9faef7f8d1f28124c1fe94c3f Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Tue, 24 Jul 2012 11:13:06 +0200 Subject: [PATCH] Since we only have the timeout option, don't be too generic. --- rq/queue.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rq/queue.py b/rq/queue.py index 3e73f71..7d78875 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -107,7 +107,7 @@ class Queue(object): """Pushes a job ID on the corresponding Redis queue.""" self.connection.rpush(self.key, job_id) - def enqueue_call(self, func, args=None, kwargs=None, **options): + def enqueue_call(self, func, args=None, kwargs=None, timeout=None): """Creates a job to represent the delayed function call and enqueues it. @@ -115,7 +115,7 @@ class Queue(object): and kwargs as explicit arguments. Any kwargs passed to this function contain options for RQ itself. """ - timeout = options.get('timeout', self._default_timeout) + timeout = timeout or self._default_timeout job = Job.create(func, args, kwargs, connection=self.connection) return self.enqueue_job(job, timeout=timeout) @@ -140,15 +140,15 @@ class Queue(object): # Detect explicit invocations, i.e. of the form: # q.enqueue(foo, args=(1, 2), kwargs={'a': 1}, timeout=30) + timeout = None if 'args' in kwargs or 'kwargs' in kwargs: assert args == (), 'Extra positional arguments cannot be used when using explicit args and kwargs.' # noqa - options = kwargs + timeout = kwargs.pop('timeout', None) args = kwargs.pop('args', None) kwargs = kwargs.pop('kwargs', None) - else: - options = {} - return self.enqueue_call(func=f, args=args, kwargs=kwargs, **options) + return self.enqueue_call(func=f, args=args, kwargs=kwargs, + timeout=timeout) def enqueue_job(self, job, timeout=None, set_meta_data=True): """Enqueues a job for delayed execution.