From cd62b4cb50f41c95ec4b15ef84656688438c807e Mon Sep 17 00:00:00 2001 From: lowercase00 <21188280+lowercase00@users.noreply.github.com> Date: Thu, 2 Feb 2023 00:54:09 -0300 Subject: [PATCH] Fix bug when running worker on debug mode (#1785) When running on debug mode, some debug logs were using colorizers on lists, which would raise an unhandled exception on the worker. The same happened for a debug log that was using colors on a response from Redis (bytes). --- rq/queue.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rq/queue.py b/rq/queue.py index 54b72a0..79125ce 100644 --- a/rq/queue.py +++ b/rq/queue.py @@ -983,13 +983,14 @@ class Queue: if timeout is not None: # blocking variant if timeout == 0: raise ValueError('RQ does not support indefinite timeouts. Please pick a timeout value > 0') - logger.debug(f"Starting BLPOP operation for queues {green(queue_keys)} with timeout of {timeout}") + colored_queues = [green(queue) for queue in queue_keys] + logger.debug(f"Starting BLPOP operation for queues {colored_queues} with timeout of {timeout}") result = connection.blpop(queue_keys, timeout) if result is None: - logger.debug(f"BLPOP Timeout, no jobs found on queues {green(queue_keys)}") + logger.debug(f"BLPOP Timeout, no jobs found on queues {colored_queues}") raise DequeueTimeout(timeout, queue_keys) queue_key, job_id = result - logger.debug(f"Dequeued job {blue(job_id)} from queue {green(queue_key)}") + logger.debug(f"Dequeued job {blue(job_id.decode('utf-8'))} from queue {green(queue_key.decode('utf-8'))}") return queue_key, job_id else: # non-blocking variant for queue_key in queue_keys: