mirror of https://github.com/rq/rq.git
fix listindex error (#1700)
This commit is contained in:
parent
8e3283dab3
commit
153d29cce7
14
rq/worker.py
14
rq/worker.py
|
@ -219,16 +219,24 @@ class Worker:
|
|||
connection.client_setname(self.name)
|
||||
except redis.exceptions.ResponseError:
|
||||
warnings.warn(
|
||||
'CLIENT command not supported, setting ip_address to unknown',
|
||||
'CLIENT SETNAME command not supported, setting ip_address to unknown',
|
||||
Warning
|
||||
)
|
||||
self.ip_address = 'unknown'
|
||||
else:
|
||||
self.ip_address = [
|
||||
client_adresses = [
|
||||
client['addr']
|
||||
for client in connection.client_list()
|
||||
if client['name'] == self.name
|
||||
][0]
|
||||
]
|
||||
if len(client_adresses) > 0:
|
||||
self.ip_address = client_adresses[0]
|
||||
else:
|
||||
warnings.warn(
|
||||
'CLIENT LIST command not supported, setting ip_address to unknown',
|
||||
Warning
|
||||
)
|
||||
self.ip_address = 'unknown'
|
||||
else:
|
||||
self.hostname = None
|
||||
self.pid = None
|
||||
|
|
Loading…
Reference in New Issue