lib/rocket_job/batch/worker.rb in rocketjob-6.0.0.rc1 vs lib/rocket_job/batch/worker.rb in rocketjob-6.0.0.rc2

- old
+ new

@@ -94,11 +94,11 @@ def rocket_job_active_workers(server_name = nil) servers = [] case sub_state when :before, :after if running? && (server_name.nil? || worker_on_server?(server_name)) - servers << ActiveWorker.new(worker_name, started_at, self) if running? + servers << ActiveWorker.new(worker_name, started_at, self) end when :processing query = input.running query = query.where(worker_name: /\A#{server_name}/) if server_name query.each do |slice| @@ -244,10 +244,10 @@ fail_job = true unless new_record? # Fail job iff no other worker has already finished it # Must set write concern to at least 1 since we need the nModified back - result = self.class.with(write: {w: 1}) do |query| + result = self.class.with(write: {w: 1}) do |query| query. where(id: id, state: :running, sub_state: :processing). update({"$set" => {state: :failed, worker_name: worker_name}}) end fail_job = false unless result.modified_count.positive?