Module: LLM::Provider::Transport::HTTP::Interruptible Private
- Included in:
- LLM::Provider::Transport::HTTP
- Defined in:
- lib/llm/provider/transport/http/interruptible.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Internal request interruption methods for LLM::Provider::Transport::HTTP.
This module tracks active requests by execution owner and provides the logic used to interrupt an in-flight request by closing the active HTTP connection.
Defined Under Namespace
Classes: Request
Constant Summary collapse
- INTERRUPT_ERRORS =
-
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
-
[::IOError, ::EOFError, Errno::EBADF].freeze
Instance Method Summary collapse
-
#interrupt!(owner) ⇒
nil private
Interrupt an active request, if any.
Instance Method Details
#interrupt!(owner) ⇒ nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Interrupt an active request, if any.
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/llm/provider/transport/http/interruptible.rb', line 24 def interrupt!(owner) req = request_for(owner) or return lock { (@interrupts ||= {})[owner] = true } if persistent_http?(req.http) close_socket(req.connection&.http) req.http.finish(req.connection) elsif transient_http?(req.http) close_socket(req.http) req.http.finish if req.http.active? end rescue *INTERRUPT_ERRORS nil end |