Class: Qs::QsRunner
Constant Summary collapse
- TimeoutInterrupt =
this error should never be “swallowed”, if it is caught be sure to re-raise it so the workers will be able to honor their timeout setting. otherwise workers will never timeout.
Class.new(Interrupt)
Instance Attribute Summary collapse
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Attributes inherited from Runner
#handler, #handler_class, #logger, #message, #params
Instance Method Summary collapse
-
#initialize(handler_class, args = nil) ⇒ QsRunner
constructor
A new instance of QsRunner.
- #run ⇒ Object
Methods inherited from Runner
Constructor Details
Instance Attribute Details
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
9 10 11 |
# File 'lib/qs/qs_runner.rb', line 9 def timeout @timeout end |
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/qs/qs_runner.rb', line 16 def run MuchTimeout.optional_timeout(self.timeout, TimeoutInterrupt) do catch(:halt) do self.handler.qs_run_callback 'before' catch(:halt){ self.handler.qs_init; self.handler.qs_run } self.handler.qs_run_callback 'after' end end rescue TimeoutInterrupt => exception error = Qs::TimeoutError.new "#{handler_class} timed out (#{timeout}s)" error.set_backtrace(exception.backtrace) raise error end |