Sha256: 85b37d64571b321e568be20165b40e1db4f0235b2900fc2e20b6e33056fd550b
Contents?: true
Size: 845 Bytes
Versions: 3
Compression:
Stored size: 845 Bytes
Contents
module ProconBypassMan class Worker attr_accessor :pid def self.run new.run end # @param [Boolean] def run return self if @thread @thread = Thread.new do while(item = ProconBypassMan::Background::JobQueue.pop) begin # プロセスを越えるので、文字列でenqueueしてくれる前提. evalしてクラスにする ProconBypassMan::Background::JobPerformer.new(klass: eval(item[:job_class]), args: item[:args]).perform rescue => e ProconBypassMan.logger.error(e) sleep(0.2) # busy loopしないように end end end return self end # 重要な非同期ジョブは存在しないのでqueueが捌けるのを待たずにkill def shutdown @thread&.kill end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
procon_bypass_man-0.3.1 | lib/procon_bypass_man/worker.rb |
procon_bypass_man-0.3.0 | lib/procon_bypass_man/worker.rb |
procon_bypass_man-0.2.3 | lib/procon_bypass_man/worker.rb |