diff --git a/lib/solid_queue/engine.rb b/lib/solid_queue/engine.rb index 9ba7f37a..72d7889e 100644 --- a/lib/solid_queue/engine.rb +++ b/lib/solid_queue/engine.rb @@ -27,5 +27,11 @@ class Engine < ::Rails::Engine self.logger = app.logger end end + + initializer "solid_queue.active_job.extensions" do + ActiveSupport.on_load :active_job do + include ActiveJob::ConcurrencyControls + end + end end end diff --git a/test/dummy/app/jobs/sequential_update_result_job.rb b/test/dummy/app/jobs/sequential_update_result_job.rb index bd43b46b..ccfbcf21 100644 --- a/test/dummy/app/jobs/sequential_update_result_job.rb +++ b/test/dummy/app/jobs/sequential_update_result_job.rb @@ -1,5 +1,3 @@ class SequentialUpdateResultJob < UpdateResultJob - include ActiveJob::ConcurrencyControls - restrict_concurrency_with limit: 1, 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 e0a1f004..2be0d96b 100644 --- a/test/dummy/app/jobs/throttled_update_result_job.rb +++ b/test/dummy/app/jobs/throttled_update_result_job.rb @@ -1,5 +1,3 @@ class ThrottledUpdateResultJob < UpdateResultJob - include ActiveJob::ConcurrencyControls - restrict_concurrency_with limit: 3, key: ->(job_result, **) { job_result } end diff --git a/test/dummy/app/jobs/update_result_job.rb b/test/dummy/app/jobs/update_result_job.rb index 3c9de511..04571eb6 100644 --- a/test/dummy/app/jobs/update_result_job.rb +++ b/test/dummy/app/jobs/update_result_job.rb @@ -1,6 +1,4 @@ class UpdateResultJob < ApplicationJob - include ActiveJob::ConcurrencyControls - def perform(job_result, name:, pause: nil, exception: nil) job_result.status += "s#{name}" diff --git a/test/models/solid_queue/job_test.rb b/test/models/solid_queue/job_test.rb index bda03c90..34175e30 100644 --- a/test/models/solid_queue/job_test.rb +++ b/test/models/solid_queue/job_test.rb @@ -2,8 +2,6 @@ class SolidQueue::JobTest < ActiveSupport::TestCase class NonOverlappingJob < ApplicationJob - include ActiveJob::ConcurrencyControls - restrict_concurrency_with limit: 1, key: ->(job_result, **) { job_result } def perform(job_result)