From 4073aa364283b52d8a255ae74179a452daa3a903 Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Tue, 25 Apr 2023 15:51:58 -0700 Subject: [PATCH] Update `push_job_id` debug string when using pipelines (#1886) --- rq/queue.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rq/queue.py b/rq/queue.py index 77a6f3e..7a2737f 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -460,11 +460,13 @@ class Queue: at_front (bool, optional): Whether to push the job to front of the queue. Defaults to False. """ connection = pipeline if pipeline is not None else self.connection - if at_front: - result = connection.lpush(self.key, job_id) + push = connection.lpush if at_front else connection.rpush + result = push(self.key, job_id) + if pipeline is None: + self.log.debug('Pushed job %s into %s, %s job(s) are in queue.', blue(job_id), green(self.name), result) else: - result = connection.rpush(self.key, job_id) - self.log.debug('Pushed job %s into %s, %s job(s) are in queue.', blue(job_id), green(self.name), result) + # Pipelines do not return the number of jobs in the queue. + self.log.debug('Pushed job %s into %s', blue(job_id), green(self.name)) def create_job( self,