From 83617b956d43609c8b8d63489585c3f5837f90ee Mon Sep 17 00:00:00 2001 From: Dana Powers Date: Wed, 3 May 2017 08:06:59 -0700 Subject: Warn dont raise on DNS lookup failures (#1091) --- kafka/conn.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'kafka/conn.py') diff --git a/kafka/conn.py b/kafka/conn.py index 58ce836..12bd08d 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -237,11 +237,13 @@ class BrokerConnection(object): socket.AF_UNSPEC, socket.SOCK_STREAM) except socket.gaierror as ex: - raise socket.gaierror('getaddrinfo failed for {0}:{1}, ' - 'exception was {2}. Is your advertised.listeners (called' - 'advertised.host.name before Kafka 9) correct and resolvable?'.format( - self._init_host, self._init_port, ex - )) + log.warning('DNS lookup failed for {0}:{1},' + ' exception was {2}. Is your' + ' advertised.listeners (called' + ' advertised.host.name before Kafka 9)' + ' correct and resolvable?'.format( + self._init_host, self._init_port, ex)) + self._gai = [] self._gai_index = 0 else: # if self._gai already exists, then we should try the next -- cgit v1.2.1