mirror of https://github.com/rq/rq.git
fix case when client does not have a name (#2103)
* fix case when client does not have a name * lint using black
This commit is contained in:
parent
df5e99ba0b
commit
458a2ff228
|
@ -222,7 +222,9 @@ class BaseWorker:
|
||||||
warnings.warn('CLIENT SETNAME command not supported, setting ip_address to unknown', Warning)
|
warnings.warn('CLIENT SETNAME command not supported, setting ip_address to unknown', Warning)
|
||||||
self.ip_address = 'unknown'
|
self.ip_address = 'unknown'
|
||||||
else:
|
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:
|
if len(client_adresses) > 0:
|
||||||
self.ip_address = client_adresses[0]
|
self.ip_address = client_adresses[0]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue