lib/litejob/server.rb in litejob-0.2.1 vs lib/litejob/server.rb in litejob-0.2.2
- old
+ new
@@ -35,20 +35,22 @@
result
end
def run!
@scheduler.spawn do
+ Litejob.logger.info("[litejob]:[RUN] id=#{@scheduler.context.object_id}")
worker_sleep_index = 0
while @running
processed = 0
@prioritized_queues.each do |priority, queues|
queues.each do |queue, spawns|
batched = 0
while (batched < priority) && (payload = pop(queue))
batched += 1
processed += 1
- processor = Processor.new(payload)
+ id, serialized_job = payload
+ processor = Processor.new(queue, id, serialized_job)
processor.process!
# give other contexts a chance to run here
@scheduler.switch
end