From 458a2ff228faa77228931c3db864b3486a65b1cc Mon Sep 17 00:00:00 2001 From: Wei-Chun Kao Date: Thu, 18 Jul 2024 10:45:37 +0800 Subject: [PATCH] fix case when client does not have a name (#2103) * fix case when client does not have a name * lint using black --- rq/worker.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rq/worker.py b/rq/worker.py index f792d1b9..91c204bc 100644 --- a/rq/worker.py +++ b/rq/worker.py @@ -222,7 +222,9 @@ class BaseWorker: warnings.warn('CLIENT SETNAME command not supported, setting ip_address to unknown', Warning) self.ip_address = 'unknown' else: - client_adresses = [client['addr'] for client in connection.client_list() if client['name'] == self.name] + client_adresses = [ + client['addr'] for client in connection.client_list() if client.get('name') == self.name + ] if len(client_adresses) > 0: self.ip_address = client_adresses[0] else: