Class: Turbopuffer::Internal::RespondAsync::Timeout Private
- Inherits:
-
Object
- Object
- Turbopuffer::Internal::RespondAsync::Timeout
- Defined in:
- lib/turbopuffer/internal/respond_async.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Timeout tracking for async polling.
Instance Method Summary collapse
-
#initialize(timeout) ⇒ Timeout
constructor
private
A new instance of Timeout.
- #poll_timeout ⇒ Float private
- #remaining ⇒ Float private
- #sleep_duration ⇒ Float private
Constructor Details
#initialize(timeout) ⇒ Timeout
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.
Returns a new instance of Timeout.
28 29 30 |
# File 'lib/turbopuffer/internal/respond_async.rb', line 28 def initialize(timeout) @deadline = Turbopuffer::Internal::Util.monotonic_secs + timeout end |
Instance Method Details
#poll_timeout ⇒ Float
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.
38 39 40 |
# File 'lib/turbopuffer/internal/respond_async.rb', line 38 def poll_timeout [remaining, POLL_REQUEST_TIMEOUT].min end |
#remaining ⇒ Float
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.
33 34 35 |
# File 'lib/turbopuffer/internal/respond_async.rb', line 33 def remaining [@deadline - Turbopuffer::Internal::Util.monotonic_secs, 0].max end |
#sleep_duration ⇒ Float
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.
43 44 45 |
# File 'lib/turbopuffer/internal/respond_async.rb', line 43 def sleep_duration [remaining, POLL_INTERVAL].min end |