Skip to content

Commit

Permalink
Log an error for every failed attempt to connect to master
Browse files Browse the repository at this point in the history
The connection timeout and number of attempts are hardcoded, so a failure will take very long
These log lines will allow to troubleshoot issues with the connection to master
  • Loading branch information
gdm85 committed Jul 21, 2022
1 parent a37a9b2 commit 54bd2e4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions locust/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,10 @@ def connect_to_master(self):
self.client.send(Message("client_ready", __version__, self.client_id))
success = self.connection_event.wait(timeout=CONNECT_TIMEOUT)
if not success:
if self.retry < 3:
logger.debug(f"Failed to connect to master {self.master_host}:{self.master_port}, retry {self.retry}/{CONNECT_RETRY_COUNT}.")
else:
logger.warning(f"Failed to connect to master {self.master_host}:{self.master_port}, retry {self.retry}/{CONNECT_RETRY_COUNT}.")
if self.retry > CONNECT_RETRY_COUNT:
raise ConnectionError()
self.connect_to_master()
Expand Down

0 comments on commit 54bd2e4

Please sign in to comment.