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

Adds a concurrency key to the jobs depending on the user_id

Marcello Rocha8c33cb59ef41
diff --git a/app/workers/mails/reminder_job.rb b/app/workers/mails/reminder_job.rb
index 7e088434228..afcac61bac0 100644
--- a/app/workers/mails/reminder_job.rb
+++ b/app/workers/mails/reminder_job.rb
@@ -30,7 +30,10 @@ class Mails::ReminderJob < Mails::DeliverJob
include ::Notifications::WithMarkedNotifications
include GoodJob::ActiveJobExtensions::Concurrency
- good_job_control_concurrency_with total_limit: 1
+ good_job_control_concurrency_with(
+ total_limit: 1,
+ key: -> { "#{self.class.name}-#{arguments.last}" }
+ )
private
diff --git a/app/workers/notifications/create_date_alerts_notifications_job.rb b/app/workers/notifications/create_date_alerts_notifications_job.rb
index 98e8beb6955..181c5028668 100644
--- a/app/workers/notifications/create_date_alerts_notifications_job.rb
+++ b/app/workers/notifications/create_date_alerts_notifications_job.rb
@@ -30,7 +30,10 @@ module Notifications
class CreateDateAlertsNotificationsJob < ApplicationJob
include GoodJob::ActiveJobExtensions::Concurrency
- good_job_control_concurrency_with total_limit: 1
+ good_job_control_concurrency_with(
+ total_limit: 1,
+ key: -> { "#{self.class.name}-#{arguments.last}" }
+ )
def perform(user)
return unless EnterpriseToken.allows_to?(:date_alerts)