Agent: Use MEDIUM_REQUEST_TIMEOUT for contacting the island

This will drop something like 30 seconds off of our tunneling test.
Generally speaking, 5 seconds seems like enough time for a simple HTTP
request to make a round trip within a local network. If we see issues in
practice, we can make this value configurable at runtime.
This commit is contained in:
Mike Salvatore 2022-04-15 08:54:24 -04:00
parent cbcb0dd1c1
commit 65e28e987b
1 changed files with 2 additions and 7 deletions

View File

@ -22,11 +22,6 @@ logger = logging.getLogger(__name__)
PBA_FILE_DOWNLOAD = "https://%s/api/pba/download/%s" PBA_FILE_DOWNLOAD = "https://%s/api/pba/download/%s"
# random number greater than 5,
# to prevent the monkey from just waiting forever to try and connect to an island before going
# elsewhere.
TIMEOUT_IN_SECONDS = 15
class ControlClient(object): class ControlClient(object):
proxies = {} proxies = {}
@ -60,7 +55,7 @@ class ControlClient(object):
headers={"content-type": "application/json"}, headers={"content-type": "application/json"},
verify=False, verify=False,
proxies=ControlClient.proxies, proxies=ControlClient.proxies,
timeout=20, timeout=MEDIUM_REQUEST_TIMEOUT,
) )
@staticmethod @staticmethod
@ -86,7 +81,7 @@ class ControlClient(object):
f"https://{server}/api?action=is-up", f"https://{server}/api?action=is-up",
verify=False, verify=False,
proxies=ControlClient.proxies, proxies=ControlClient.proxies,
timeout=TIMEOUT_IN_SECONDS, timeout=MEDIUM_REQUEST_TIMEOUT,
) )
WormConfiguration.current_server = current_server WormConfiguration.current_server = current_server
break break