Update `push_job_id` debug string when using pipelines (#1886)

This commit is contained in:
Rob Hudson 2023-04-25 15:51:58 -07:00 committed by GitHub
parent 77e926c424
commit 4073aa3642
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -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,