Closed jgraichen closed 6 years ago
Hmm... let's (ahem) sleep over this one for a bit. I just read too many bad things about Ruby's Timeout
module:
Most importantly, this one: https://vaneyckt.io/posts/the_disaster_that_is_rubys_timeout_method/
(That has a nice example that could help us find out whether Timeout.timeout
causes problems with Restify as well.)
This might be a helpful, more positive, resource: https://github.com/ankane/the-ultimate-guide-to-ruby-timeouts
Interesting. No article seems to mention Thread#handle_interrupt
.
I've made a new implementation based on an high-res timer interval that is used to pass the remaining time to subsequent operations. Running code such as promise code blocks will not be interrupted.
This PR introduce a timeout capability to promises defaulting to 300 seconds. The timeout is required and cannot be zero.