From 0c3541a97ac370f67d8d81da305c39d8f6be13b9 Mon Sep 17 00:00:00 2001 From: "Ben Sheldon [he/him]" Date: Thu, 14 Mar 2024 22:10:37 -0700 Subject: [PATCH] Don't be fancy with bind parameters just yet --- lib/good_job/active_job_extensions/concurrency.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/good_job/active_job_extensions/concurrency.rb b/lib/good_job/active_job_extensions/concurrency.rb index 7df98076c..d84e158d9 100644 --- a/lib/good_job/active_job_extensions/concurrency.rb +++ b/lib/good_job/active_job_extensions/concurrency.rb @@ -96,7 +96,7 @@ def deserialize(job_data) query = DiscreteExecution.joins(:job) .where(GoodJob::Job.table_name => { concurrency_key: key }) - .where(DiscreteExecution.arel_table[:created_at].gt(ActiveModel::Attribute.with_cast_value("created_at", throttle_period.ago, ActiveModel::Type.default_value))) + .where(DiscreteExecution.arel_table[:created_at].gt(throttle_period.ago)) allowed_active_job_ids = query.where(error: nil).or(query.where.not(error: "GoodJob::ActiveJobExtensions::Concurrency::ThrottleExceededError: GoodJob::ActiveJobExtensions::Concurrency::ThrottleExceededError")) .order(created_at: :asc) .limit(throttle_limit) @@ -192,7 +192,7 @@ def good_job_enqueue_concurrency_check(job, on_abort:, on_enqueue:) throttle_limit = throttle[0] throttle_period = throttle[1] enqueued_within_period = GoodJob::Job.where(concurrency_key: key) - .where(GoodJob::Job.arel_table[:created_at].gt(Arel::Nodes::BindParam.new(ActiveModel::Attribute.with_cast_value("created_at", throttle_period.ago, ActiveModel::Type.default_value)))) + .where(GoodJob::Job.arel_table[:created_at].gt(throttle_period.ago)) .count if (enqueued_within_period + 1) > throttle_limit