From db75958ad23d1ae16a028210a04bcd03e3a540b2 Mon Sep 17 00:00:00 2001 From: Travis Johnson Date: Fri, 12 Dec 2014 12:25:33 -0500 Subject: [PATCH] use 'at_front' instead of 'skip_queue' --- rq/queue.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/rq/queue.py b/rq/queue.py index ddb31e6..847319f 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -161,18 +161,18 @@ class Queue(object): if self.job_class.exists(job_id, self.connection): self.connection.rpush(self.key, job_id) - def push_job_id(self, job_id, pipeline=None, skip_queue=False): + def push_job_id(self, job_id, pipeline=None, at_front=False): """Pushes a job ID on the corresponding Redis queue. - 'skip_queue' allows you to push the job onto the front instead of the back of the queue""" + 'at_front' allows you to push the job onto the front instead of the back of the queue""" connection = pipeline if pipeline is not None else self.connection - if skip_queue: + if at_front: connection.lpush(self.key, job_id) else: connection.rpush(self.key, job_id) def enqueue_call(self, func, args=None, kwargs=None, timeout=None, result_ttl=None, description=None, depends_on=None, - job_id=None, skip_queue=False): + job_id=None, at_front=False): """Creates a job to represent the delayed function call and enqueues it. @@ -208,7 +208,7 @@ class Queue(object): except WatchError: continue - return self.enqueue_job(job, skip_queue=skip_queue) + return self.enqueue_job(job, at_front=at_front) def enqueue(self, f, *args, **kwargs): """Creates a job to represent the delayed function call and enqueues @@ -235,7 +235,7 @@ class Queue(object): result_ttl = kwargs.pop('result_ttl', None) depends_on = kwargs.pop('depends_on', None) job_id = kwargs.pop('job_id', None) - skip_queue = kwargs.pop('skip_queue', False) + at_front = kwargs.pop('at_front', False) if 'args' in kwargs or 'kwargs' in kwargs: assert args == (), 'Extra positional arguments cannot be used when using explicit args and kwargs.' # noqa @@ -245,9 +245,9 @@ class Queue(object): return self.enqueue_call(func=f, args=args, kwargs=kwargs, timeout=timeout, result_ttl=result_ttl, description=description, depends_on=depends_on, - job_id=job_id, skip_queue=skip_queue) + job_id=job_id, at_front=at_front) - def enqueue_job(self, job, set_meta_data=True, skip_queue=False): + def enqueue_job(self, job, set_meta_data=True, at_front=False): """Enqueues a job for delayed execution. If the `set_meta_data` argument is `True` (default), it will update @@ -267,7 +267,7 @@ class Queue(object): job.save() if self._async: - self.push_job_id(job.id, skip_queue=skip_queue) + self.push_job_id(job.id, at_front=at_front) else: job.perform() job.save()