TIMEx — a deadline engine for Ruby
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. TIMEx 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.
Post a comment