From 0b5a90adac2f51e257a2ec3ec9e954a4b0d52f52 Mon Sep 17 00:00:00 2001 From: Cyril Chapellier Date: Mon, 22 May 2023 04:07:30 +0200 Subject: [PATCH] Fix as_text in certain conditions (#1917) --- rq/worker.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rq/worker.py b/rq/worker.py index 4c38adfb..267f9c1c 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -1040,12 +1040,11 @@ class Worker(BaseWorker): version, python_version, ) = data - queues = as_text(queues) - self.hostname = as_text(hostname) - self.ip_address = as_text(ip_address) + self.hostname = as_text(hostname) if hostname else None + self.ip_address = as_text(ip_address) if ip_address else None self.pid = int(pid) if pid else None - self.version = as_text(version) - self.python_version = as_text(python_version) + self.version = as_text(version) if version else None + self.python_version = as_text(python_version) if python_version else None self._state = as_text(state or '?') self._job_id = job_id or None if last_heartbeat: @@ -1066,6 +1065,7 @@ class Worker(BaseWorker): self.current_job_working_time = float(as_text(current_job_working_time)) if queues: + queues = as_text(queues) self.queues = [ self.queue_class( queue, connection=self.connection, job_class=self.job_class, serializer=self.serializer