class RubyJob::ThreadedServer
Attributes
options[R]
Public Class Methods
new(num_threads:, jobstore:)
click to toggle source
# File lib/ruby_job/threaded_server.rb, line 7 def initialize(num_threads:, jobstore:) @num_threads = num_threads @jobstore = jobstore @options = { wait: true, wait_delay: 0.5 } end
Public Instance Methods
halt()
click to toggle source
# File lib/ruby_job/threaded_server.rb, line 33 def halt halt_at(Time.now) self end
halt_at(time)
click to toggle source
# File lib/ruby_job/threaded_server.rb, line 28 def halt_at(time) @jobstore.pause_at(time) self end
resume()
click to toggle source
# File lib/ruby_job/threaded_server.rb, line 38 def resume halt_at(nil) self end
resume_until(time)
click to toggle source
# File lib/ruby_job/threaded_server.rb, line 43 def resume_until(time) resume halt_at(time) self end
set(**options)
click to toggle source
# File lib/ruby_job/threaded_server.rb, line 13 def set(**options) @options.merge!(options) self end
start()
click to toggle source
# File lib/ruby_job/threaded_server.rb, line 18 def start Thread.new do @num_threads.times.map do Thread.new do JobProcessor.new(@jobstore).run(**@options) end end.each(&:join) end end