From f869eacef9e9dd99ef9e88902ea02d45ac2728e4 Mon Sep 17 00:00:00 2001 From: Cody Robbins Date: Tue, 17 Aug 2021 19:55:02 -0400 Subject: [PATCH] Don't attempt to enforce concurrency limits with other queue adapters. --- lib/good_job/active_job_extensions/concurrency.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/good_job/active_job_extensions/concurrency.rb b/lib/good_job/active_job_extensions/concurrency.rb index 6bbcc9812..c59f60b7e 100644 --- a/lib/good_job/active_job_extensions/concurrency.rb +++ b/lib/good_job/active_job_extensions/concurrency.rb @@ -10,6 +10,9 @@ module Concurrency class_attribute :good_job_concurrency_config, instance_accessor: false, default: {} around_enqueue do |job, block| + # Don't attempt to enforce concurrency limits with other queue adapters. + next(block.call) unless job.class.queue_adapter.is_a?(GoodJob::Adapter) + # Always allow jobs to be retried because the current job's execution will complete momentarily next(block.call) if CurrentExecution.active_job_id == job.job_id @@ -34,6 +37,9 @@ module Concurrency ) before_perform do |job| + # Don't attempt to enforce concurrency limits with other queue adapters. + next unless job.class.queue_adapter.is_a?(GoodJob::Adapter) + limit = job.class.good_job_concurrency_config.fetch(:perform_limit, Float::INFINITY) next if limit.blank? || (0...Float::INFINITY).exclude?(limit)