class Qs::QsRunner
Constants
- 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.
Attributes
timeout[R]
Public Class Methods
new(handler_class, args = nil)
click to toggle source
Calls superclass method
# File lib/qs/qs_runner.rb, line 11 def initialize(handler_class, args = nil) super(handler_class, args) @timeout = handler_class.timeout || Qs.config.timeout end
Public Instance Methods
run()
click to toggle source
# 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