@@ -2179,19 +2179,19 @@ def send_request(self, request: Request, timeout: int = -1) -> Optional[Response
21792179
21802180 done_receiving = False
21812181 if respect_overall_timeout :
2182- overall_timeout_time = time .time () + overall_timeout
2182+ overall_timeout_time = time .monotonic () + overall_timeout
21832183
21842184 timed_out = False
21852185 while not done_receiving and not timed_out :
21862186 done_receiving = True
21872187 self .logger .debug ("Waiting for server response" )
21882188
2189- if not respect_overall_timeout or (respect_overall_timeout and time .time () + single_request_timeout < overall_timeout_time ):
2189+ if not respect_overall_timeout or (respect_overall_timeout and time .monotonic () + single_request_timeout < overall_timeout_time ):
21902190 timeout_type_used = 'single_request'
21912191 timeout_value = single_request_timeout
21922192 else :
21932193 timeout_type_used = 'overall'
2194- timeout_value = max (overall_timeout_time - time .time (), 0 )
2194+ timeout_value = max (overall_timeout_time - time .monotonic (), 0 )
21952195
21962196 try :
21972197 recv_payload = self .conn .wait_frame (timeout = timeout_value , exception = True )
@@ -2205,13 +2205,16 @@ def send_request(self, request: Request, timeout: int = -1) -> Optional[Response
22052205 return None
22062206 if timeout_type_used == 'single_request' :
22072207 timeout_name_to_report = 'P2* timeout' if using_p2_star else 'P2 timeout'
2208+ timeout_value_to_report = single_request_timeout
22082209 elif timeout_type_used == 'overall' :
22092210 timeout_name_to_report = 'Global request timeout'
2211+ timeout_value_to_report = overall_timeout
22102212 else : # Shouldn't go here.
22112213 timeout_name_to_report = 'Timeout'
2214+ timeout_value_to_report = timeout_value
22122215
22132216 raise TimeoutException ('Did not receive response in time. %s time has expired (timeout=%.3f sec)' %
2214- (timeout_name_to_report , timeout_value ))
2217+ (timeout_name_to_report , float ( timeout_value_to_report ) ))
22152218
22162219 response = Response .from_payload (recv_payload )
22172220 self .last_response = response
0 commit comments