Skip to content

Commit 302b30c

Browse files
dpkpjeffwidman
authored andcommitted
Recheck connecting nodes sooner when refreshing metadata (#1737)
1 parent 1cd505d commit 302b30c

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

kafka/client_async.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -825,9 +825,7 @@ def refresh_done(val_or_error):
825825
# the client from unnecessarily connecting to additional nodes while a previous connection
826826
# attempt has not been completed.
827827
if self._connecting:
828-
# Strictly the timeout we should return here is "connect timeout", but as we don't
829-
# have such application level configuration, using request timeout instead.
830-
return self.config['request_timeout_ms']
828+
return self.config['reconnect_backoff_ms']
831829

832830
if self.maybe_connect(node_id):
833831
log.debug("Initializing connection to node %s for metadata request", node_id)

test/test_client_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def test_maybe_refresh_metadata_cant_send(mocker, client):
376376
client._connecting.add('foobar')
377377
client._can_connect.reset_mock()
378378
client.poll(timeout_ms=12345678)
379-
client._poll.assert_called_with(9999.999) # connection timeout (request timeout)
379+
client._poll.assert_called_with(2.222) # connection timeout (reconnect timeout)
380380
assert not client._can_connect.called
381381

382382
assert not client._metadata_refresh_in_progress

0 commit comments

Comments
 (0)