diff --git a/app/models/solid_queue/job_batch.rb b/app/models/solid_queue/job_batch.rb index a5099731..3d0de10d 100644 --- a/app/models/solid_queue/job_batch.rb +++ b/app/models/solid_queue/job_batch.rb @@ -35,7 +35,7 @@ def enqueue(attributes = {}) def dispatch_finished_batches incomplete.order(:id).pluck(:id).each do |id| transaction do - where(id:).non_blocking_lock.each(&:finish) + where(id: id).non_blocking_lock.each(&:finish) end end end @@ -82,8 +82,8 @@ def finish if on_finish_active_job.present? active_job = ActiveJob::Base.deserialize(on_finish_active_job) active_job.send(:deserialize_arguments_if_needed) - active_job.arguments = [self] + Array.wrap(active_job.arguments) - ActiveJob.perform_all_later([active_job]) + active_job.arguments = [ self ] + Array.wrap(active_job.arguments) + ActiveJob.perform_all_later([ active_job ]) attrs[:job] = Job.find_by(active_job_id: active_job.job_id) end diff --git a/lib/active_job/job_batch_id.rb b/lib/active_job/job_batch_id.rb index fc6978a6..494e197f 100644 --- a/lib/active_job/job_batch_id.rb +++ b/lib/active_job/job_batch_id.rb @@ -11,12 +11,12 @@ module JobBatchId end def serialize - super.merge('batch_id' => batch_id) + super.merge("batch_id" => batch_id) end def deserialize(job_data) super - self.batch_id = job_data['batch_id'] + self.batch_id = job_data["batch_id"] end def batch diff --git a/test/models/solid_queue/job_batch_test.rb b/test/models/solid_queue/job_batch_test.rb index 30684caf..e49f59c2 100644 --- a/test/models/solid_queue/job_batch_test.rb +++ b/test/models/solid_queue/job_batch_test.rb @@ -23,13 +23,13 @@ def perform(arg) end test "batch will be completed on success" do - batch = SolidQueue::JobBatch.enqueue(on_finish: BatchCompletionJob) {} + batch = SolidQueue::JobBatch.enqueue(on_finish: BatchCompletionJob) { } assert_not_nil batch.on_finish_active_job assert_equal BatchCompletionJob.name, batch.on_finish_active_job["job_class"] end test "batch will be completed on finish" do - batch = SolidQueue::JobBatch.enqueue(on_success: BatchCompletionJob) {} + batch = SolidQueue::JobBatch.enqueue(on_success: BatchCompletionJob) { } assert_not_nil batch.on_success_active_job assert_equal BatchCompletionJob.name, batch.on_success_active_job["job_class"] end @@ -41,7 +41,7 @@ def perform(arg) end assert_equal 2, SolidQueue::Job.count - assert_equal [batch.id] * 2, SolidQueue::Job.last(2).map(&:batch_id) + assert_equal [ batch.id ] * 2, SolidQueue::Job.last(2).map(&:batch_id) end test "batch id is present inside the block" do @@ -60,7 +60,7 @@ def perform(arg) end assert_not_nil SolidQueue::JobBatch.last.on_finish_active_job["arguments"] - assert_equal SolidQueue::JobBatch.last.on_finish_active_job["arguments"], [1, 2] + assert_equal SolidQueue::JobBatch.last.on_finish_active_job["arguments"], [ 1, 2 ] assert_equal SolidQueue::JobBatch.last.on_finish_active_job["queue_name"], "batch" end end