Skip to content

Commit

Permalink
Rename concurrency limit spec to limits_concurrency to: limit ...
Browse files Browse the repository at this point in the history
Thanks to @jorgemanrubia for the suggestion!
  • Loading branch information
rosa committed Nov 20, 2023
1 parent 26f2b6c commit 8955770
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/active_job/concurrency_controls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ module ConcurrencyControls
end

class_methods do
def restrict_concurrency_with(limit: 1, key: DEFAULT_CONCURRENCY_KEY, duration: SolidQueue.default_concurrency_control_period)
self.concurrency_limit = limit
def limits_concurrency(to: 1, key: DEFAULT_CONCURRENCY_KEY, duration: SolidQueue.default_concurrency_control_period)
self.concurrency_limit = to
self.concurrency_key = key
self.concurrency_duration = duration
end
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/app/jobs/sequential_update_result_job.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/dummy/app/jobs/throttled_update_result_job.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/models/solid_queue/job_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8955770

Please sign in to comment.