From 0ed1b4537b28f0a93507f612c421681aff52b775 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 23 Mar 2024 08:37:06 +1100 Subject: [PATCH] PERF: only allow one reviewable notification at a time (#26330) This job may notify hundreds of mods and take quite a while to run. --- app/jobs/regular/notify_reviewable.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/jobs/regular/notify_reviewable.rb b/app/jobs/regular/notify_reviewable.rb index ed8bdbc8509..8a5c35f641b 100644 --- a/app/jobs/regular/notify_reviewable.rb +++ b/app/jobs/regular/notify_reviewable.rb @@ -1,6 +1,10 @@ # frozen_string_literal: true class Jobs::NotifyReviewable < ::Jobs::Base + # this job can take a very long time if there are many mods + # do not swamp the queue with it + cluster_concurrency 1 + def execute(args) return unless reviewable = Reviewable.find_by(id: args[:reviewable_id])