Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

apply limit to only have one job running and one enqueued

ulfertse1236e29494e
diff --git a/app/workers/notifications/schedule_date_alerts_notifications_job.rb b/app/workers/notifications/schedule_date_alerts_notifications_job.rb
index 24230fe1d4d..a744e300078 100644
--- a/app/workers/notifications/schedule_date_alerts_notifications_job.rb
+++ b/app/workers/notifications/schedule_date_alerts_notifications_job.rb
@@ -29,6 +29,13 @@
module Notifications
# Creates date alert jobs for users whose local time is 1:00 am.
class ScheduleDateAlertsNotificationsJob < ApplicationJob
+ include GoodJob::ActiveJobExtensions::Concurrency
+
+ good_job_control_concurrency_with(
+ enqueue_limit: 1,
+ perform_limit: 1
+ )
+
def perform
return unless EnterpriseToken.allows_to?(:date_alerts)