TIMEx - a deadline engine for Ruby
Briefly

"Production timeouts are rarely "just call Timeout.timeout." You need a real budget, predictable expiry, and a way to pass that budget to the next service. is a small, stdlib-only gem that treats timeouts as deadlines: monotonic clocks, pluggable strategies, and one consistent API-no Rails, no ActiveSupport."
"Use TIMEx.deadline for cooperative checks in your own code, or pick a strategy (:io, :wakeup, :unsafe, and others) when the runtime can enforce the cap for you. Need a soft landing? Return a TIMEx::Result instead of raising. Calling downstream? Encode the remaining budget in X-TIMEx-Deadline."
Timeouts are rarely solved by simply calling Timeout.timeout. A real time budget is needed with predictable expiry and a way to pass that budget to the next service. TIMEx treats timeouts as deadlines using monotonic clocks and a consistent API without Rails or ActiveSupport. Cooperative checks can use TIMEx.deadline in application code. Runtime-enforced caps can be selected with strategies such as :io, :wakeup, and :unsafe. For soft failure handling, TIMEx::Result can be returned instead of raising. When calling downstream services, the remaining budget can be encoded in the X-TIMEx-Deadline header.
Read at Rubyflow
Unable to calculate read time
[
|
]