From 748644fd724d2c46fdc36ccd1ac0245433f73980 Mon Sep 17 00:00:00 2001 From: Rosa Gutierrez Date: Mon, 20 Nov 2023 18:18:02 +0100 Subject: [PATCH] Rename concurrency limit spec to `limits_concurrency to: limit ...` Thanks to @jorgemanrubia for the suggestion! --- lib/active_job/concurrency_controls.rb | 2 +- test/dummy/app/jobs/sequential_update_result_job.rb | 2 +- test/dummy/app/jobs/throttled_update_result_job.rb | 2 +- test/models/solid_queue/job_test.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/active_job/concurrency_controls.rb b/lib/active_job/concurrency_controls.rb index 895d7cfb..d74b5bbf 100644 --- a/lib/active_job/concurrency_controls.rb +++ b/lib/active_job/concurrency_controls.rb @@ -14,7 +14,7 @@ module ConcurrencyControls end class_methods do - def restrict_concurrency_with(limit: 1, key: DEFAULT_CONCURRENCY_KEY, duration: SolidQueue.default_concurrency_control_period) + def limits_concurrency(to: 1, key: DEFAULT_CONCURRENCY_KEY, duration: SolidQueue.default_concurrency_control_period) self.concurrency_limit = limit self.concurrency_key = key self.concurrency_duration = duration diff --git a/test/dummy/app/jobs/sequential_update_result_job.rb b/test/dummy/app/jobs/sequential_update_result_job.rb index ccfbcf21..a3afa33f 100644 --- a/test/dummy/app/jobs/sequential_update_result_job.rb +++ b/test/dummy/app/jobs/sequential_update_result_job.rb @@ -1,3 +1,3 @@ class SequentialUpdateResultJob < UpdateResultJob - restrict_concurrency_with limit: 1, key: ->(job_result, **) { job_result } + limits_concurrency key: ->(job_result, **) { job_result } end diff --git a/test/dummy/app/jobs/throttled_update_result_job.rb b/test/dummy/app/jobs/throttled_update_result_job.rb index 2be0d96b..c6deb5b4 100644 --- a/test/dummy/app/jobs/throttled_update_result_job.rb +++ b/test/dummy/app/jobs/throttled_update_result_job.rb @@ -1,3 +1,3 @@ class ThrottledUpdateResultJob < UpdateResultJob - restrict_concurrency_with limit: 3, key: ->(job_result, **) { job_result } + limits_concurrency to: 3, key: ->(job_result, **) { job_result } end diff --git a/test/models/solid_queue/job_test.rb b/test/models/solid_queue/job_test.rb index 34175e30..2ad8ad67 100644 --- a/test/models/solid_queue/job_test.rb +++ b/test/models/solid_queue/job_test.rb @@ -2,7 +2,7 @@ class SolidQueue::JobTest < ActiveSupport::TestCase class NonOverlappingJob < ApplicationJob - restrict_concurrency_with limit: 1, key: ->(job_result, **) { job_result } + limits_concurrency key: ->(job_result, **) { job_result } def perform(job_result) end