MCPcopy
hub / github.com/tornadoweb/tornado / _on_timeout

Method _on_timeout

tornado/simple_httpclient.py:230–249  ·  view source on GitHub ↗

Timeout callback of request. Construct a timeout HTTPResponse when a timeout occurs. :arg object key: A simple object to mark the request. :info string key: More detailed timeout information.

(self, key: object, info: Optional[str] = None)

Source from the content-addressed store, hash-verified

228 del self.waiting[key]
229
230 def _on_timeout(self, key: object, info: Optional[str] = None) -> None:
231 """Timeout callback of request.
232
233 Construct a timeout HTTPResponse when a timeout occurs.
234
235 :arg object key: A simple object to mark the request.
236 :info string key: More detailed timeout information.
237 """
238 request, callback, timeout_handle = self.waiting[key]
239 self.queue.remove((key, request, callback))
240
241 error_message = f"Timeout {info}" if info else "Timeout"
242 timeout_response = HTTPResponse(
243 request,
244 599,
245 error=HTTPTimeoutError(error_message),
246 request_time=self.io_loop.time() - request.start_time,
247 )
248 self.io_loop.add_callback(callback, timeout_response)
249 del self.waiting[key]
250
251
252class _HTTPConnection(httputil.HTTPMessageDelegate):

Callers

nothing calls this directly

Calls 4

HTTPResponseClass · 0.90
HTTPTimeoutErrorClass · 0.85
timeMethod · 0.80
add_callbackMethod · 0.45

Tested by

no test coverage detected