fix listindex error (#1700)

main
Burak Yılmaz 2 years ago committed by GitHub
parent 8e3283dab3
commit 153d29cce7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save