def _setup_hosts(self, hosts):
# Override to only accept tuples, since the redis.sentinel.Sentinel does not accept URLs
if not hosts:
hosts = [("localhost", 26379)]
final_hosts = list()
if isinstance(hosts, six.string_types):
# user accidentally used one host string instead of providing a list of hosts
raise ValueError("ASGI Redis hosts must be specified as an iterable list of hosts.")
for entry in hosts:
if isinstance(entry, six.string_types):
raise ValueError("Sentinel Redis host entries must be specified as tuples, not strings.")
else:
final_hosts.append(entry)
return final_hosts
评论列表
文章目录