Commit cbe5c666 authored by Alexandre's avatar Alexandre
Browse files

[DoT] Pipelining: improve timeout calculation

The purpose of the timeout is to avoid endlessly waiting for a reply.
Therefore, the timeout should be calculated starting from the last sent
query.
parent 97e6119c
...@@ -276,17 +276,12 @@ class ConnectionDOT(Connection): ...@@ -276,17 +276,12 @@ class ConnectionDOT(Connection):
for request in requests_list: for request in requests_list:
self.all_requests.append({'request': request, 'response': None}) # No answer yet self.all_requests.append({'request': request, 'response': None}) # No answer yet
start = time.time() start_idle = time.time()
done = 0 done = 0
current_index = 0 current_index = 0
while done < len(requests_list): while done < len(requests_list):
if time.time() > start + homer.MAX_DURATION: # if we send thousands of requests if time.time() > start_idle + homer.MAX_DURATION: # nothing happened in a while
# MAX_DURATION will be reached
# need to increase MAX_DURATION based
# on the number of queries
# or to define a relation such as
# f(tests) = MAX_DURATION
raise homer.PipeliningException("Elapsed time too long, %i/%i requests never got a reply" % (len(requests_list) - done, len(requests_list))) raise homer.PipeliningException("Elapsed time too long, %i/%i requests never got a reply" % (len(requests_list) - done, len(requests_list)))
# add request to pending list and send it # add request to pending list and send it
...@@ -310,6 +305,8 @@ class ConnectionDOT(Connection): ...@@ -310,6 +305,8 @@ class ConnectionDOT(Connection):
self.n_in_flight += 1 self.n_in_flight += 1
current_index += 1 current_index += 1
start_idle = time.time() # reset timeout starting point
# look for a potential response # look for a potential response
if self.verbose: if self.verbose:
print('Looking for a response...') print('Looking for a response...')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment