For context, I have a Locust task that issues an HTTP request that I want to time out if it doesn’t complete in N seconds. This differs from using the request timeout parameter since that only fails if no bytes are returned within a timeout.
I used the following User:
class MyLoadTestUser(FastHttpUser):
network_timeout = 8.5
connection_timeout = 2.0
@locust.task
def t(self):
start_time = datetime.now()
resp = self.client.post(url={path}, json={body}, timeout=9.5)
end_time = datetime.now()
print((end_time - start_time).total_seconds() * 1000)
The printed latency was sometimes over 15-20s so it seems like neither FastHttpUser’s network_timeout nor the client’s timeout is being obeyed.
New contributor
Justin Borromeo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.