Debug mode log fixes (#1798)

Current worker on debug mode doesn't raises errors,
but does have some formatting issues.
This commit is contained in:
lowercase00 2023-02-04 23:32:41 -03:00 committed by GitHub
parent fdb14df181
commit 27cbf48ad4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -1155,14 +1155,13 @@ class Queue:
if timeout is not None: # blocking variant if timeout is not None: # blocking variant
if timeout == 0: if timeout == 0:
raise ValueError('RQ does not support indefinite timeouts. Please pick a timeout value > 0') raise ValueError('RQ does not support indefinite timeouts. Please pick a timeout value > 0')
colored_queues = [green(queue) for queue in queue_keys] colored_queues = ''.join(map(str, [green(str(queue)) for queue in queue_keys]))
logger.debug(f"Starting BLPOP operation for queues {colored_queues} with timeout of {timeout}") logger.debug(f"Starting BLPOP operation for queues {colored_queues} with timeout of {timeout}")
result = connection.blpop(queue_keys, timeout) result = connection.blpop(queue_keys, timeout)
if result is None: if result is None:
logger.debug(f"BLPOP Timeout, no jobs found on queues {colored_queues}") logger.debug(f"BLPOP Timeout, no jobs found on queues {colored_queues}")
raise DequeueTimeout(timeout, queue_keys) raise DequeueTimeout(timeout, queue_keys)
queue_key, job_id = result queue_key, job_id = result
logger.debug(f"Dequeued job {blue(job_id.decode('utf-8'))} from queue {green(queue_key.decode('utf-8'))}")
return queue_key, job_id return queue_key, job_id
else: # non-blocking variant else: # non-blocking variant
for queue_key in queue_keys: for queue_key in queue_keys:

View File

@ -752,7 +752,7 @@ class Worker:
if self.should_run_maintenance_tasks: if self.should_run_maintenance_tasks:
self.run_maintenance_tasks() self.run_maintenance_tasks()
self.log.debug(f"Dequeueing jobs on queues {self._ordered_queues} and timeout {timeout}") self.log.debug(f"Dequeueing jobs on queues {green(qnames)} and timeout {timeout}")
result = self.queue_class.dequeue_any( result = self.queue_class.dequeue_any(
self._ordered_queues, self._ordered_queues,
timeout, timeout,
@ -760,9 +760,8 @@ class Worker:
job_class=self.job_class, job_class=self.job_class,
serializer=self.serializer, serializer=self.serializer,
) )
self.log.debug(f"Dequeued job {result[1]} from {result[0]}")
if result is not None: if result is not None:
self.log.debug(f"Dequeued job {blue(result[0].id)} from {green(result[1].name)}")
job, queue = result job, queue = result
job.redis_server_version = self.get_redis_server_version() job.redis_server_version = self.get_redis_server_version()
if self.log_job_description: if self.log_job_description: