Skip to content

Commit e31c18a

Browse files
committed
Warn dont raise on DNS lookup failures
1 parent 120410b commit e31c18a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

kafka/conn.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,13 @@ def connect(self):
237237
socket.AF_UNSPEC,
238238
socket.SOCK_STREAM)
239239
except socket.gaierror as ex:
240-
raise socket.gaierror('getaddrinfo failed for {0}:{1}, '
241-
'exception was {2}. Is your advertised.listeners (called'
242-
'advertised.host.name before Kafka 9) correct and resolvable?'.format(
243-
self._init_host, self._init_port, ex
244-
))
240+
log.warning('DNS lookup failed for {0}:{1},'
241+
' exception was {2}. Is your'
242+
' advertised.listeners (called'
243+
' advertised.host.name before Kafka 9)'
244+
' correct and resolvable?'.format(
245+
self._init_host, self._init_port, ex))
246+
self._gai = []
245247
self._gai_index = 0
246248
else:
247249
# if self._gai already exists, then we should try the next

0 commit comments

Comments
 (0)