@@ -2179,19 +2179,19 @@ def send_request(self, request: Request, timeout: int = -1) -> Optional[Response
2179
2179
2180
2180
done_receiving = False
2181
2181
if respect_overall_timeout :
2182
- overall_timeout_time = time .time () + overall_timeout
2182
+ overall_timeout_time = time .monotonic () + overall_timeout
2183
2183
2184
2184
timed_out = False
2185
2185
while not done_receiving and not timed_out :
2186
2186
done_receiving = True
2187
2187
self .logger .debug ("Waiting for server response" )
2188
2188
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 ):
2190
2190
timeout_type_used = 'single_request'
2191
2191
timeout_value = single_request_timeout
2192
2192
else :
2193
2193
timeout_type_used = 'overall'
2194
- timeout_value = max (overall_timeout_time - time .time (), 0 )
2194
+ timeout_value = max (overall_timeout_time - time .monotonic (), 0 )
2195
2195
2196
2196
try :
2197
2197
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
2205
2205
return None
2206
2206
if timeout_type_used == 'single_request' :
2207
2207
timeout_name_to_report = 'P2* timeout' if using_p2_star else 'P2 timeout'
2208
+ timeout_value_to_report = single_request_timeout
2208
2209
elif timeout_type_used == 'overall' :
2209
2210
timeout_name_to_report = 'Global request timeout'
2211
+ timeout_value_to_report = overall_timeout
2210
2212
else : # Shouldn't go here.
2211
2213
timeout_name_to_report = 'Timeout'
2214
+ timeout_value_to_report = timeout_value
2212
2215
2213
2216
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 ) ))
2215
2218
2216
2219
response = Response .from_payload (recv_payload )
2217
2220
self .last_response = response
0 commit comments