lib/right_chimp/queue/QueueWorker.rb in right_chimp-2.1.25 vs lib/right_chimp/queue/QueueWorker.rb in right_chimp-2.1.25.2

- old
+ new

@@ -25,23 +25,28 @@ job_uuid = work_item.job_uuid group = work_item.group.group_id work_item.retry_count = @retry_count work_item.owner = Thread.current.object_id + ChimpDaemon.instance.semaphore.synchronize do # remove from the processing queue - Log.debug 'Decreasing processing counter (' + (ChimpDaemon.instance.proc_counter-1).to_s + ') for [' + job_uuid + '] group: ' + group.to_s - ChimpDaemon.instance.queue.processing[group][job_uuid.to_sym] -= 1 - Log.debug ChimpDaemon.instance.queue.processing[group].inspect - if ChimpDaemon.instance.queue.processing[group][job_uuid.to_sym] == 0 - Log.debug 'Completed processing task ' + job_uuid - ChimpDaemon.instance.queue.processing[group].delete(job_uuid.to_sym) - Log.debug ChimpDaemon.instance.queue.processing.inspect + Log.debug 'Decreasing processing counter (' + (ChimpDaemon.instance.proc_counter-1).to_s + ') for [' + job_uuid.to_s + '] group: ' + group.to_s + # only do this if we are running with chimpd + if ChimpDaemon.instance.queue.processing[group].nil? + # no op else - Log.debug 'Still counting down for ' + job_uuid + ChimpDaemon.instance.queue.processing[group][job_uuid.to_sym] -= 1 + Log.debug ChimpDaemon.instance.queue.processing[group].inspect + if ChimpDaemon.instance.queue.processing[group][job_uuid.to_sym] == 0 + Log.debug 'Completed processing task ' + job_uuid.to_s + ChimpDaemon.instance.queue.processing[group].delete(job_uuid.to_sym) + Log.debug ChimpDaemon.instance.queue.processing.inspect + else + Log.debug 'Still counting down for ' + job_uuid.to_s + end + ChimpDaemon.instance.proc_counter -= 1 end - - ChimpDaemon.instance.proc_counter -= 1 end work_item.run sleep @delay else