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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
GoodJob concurrency for HealthStatusMailerJob
Andreas Pfohl38bba33faa5b
diff --git a/modules/storages/app/services/storages/health_service.rb b/modules/storages/app/services/storages/health_service.rbindex f7a704a53a9..ac2ecc02dbf 100644--- a/modules/storages/app/services/storages/health_service.rb+++ b/modules/storages/app/services/storages/health_service.rb@@ -71,7 +71,7 @@ module Storagesnotify_unhealthy_admin_usersend- schedule_mail_job(@storage) unless mail_job_exists?+ schedule_mail_job(@storage)endprivate@@ -91,10 +91,6 @@ module Storages::Storages::HealthStatusMailerJob.schedule(storage:)end- def mail_job_exists?- Delayed::Job.where("handler LIKE ?", "%job_class: Storages::HealthStatusMailerJob%").any?- end-def reason_is_same(new_health_reason)@storage.health_reason_identifier == ::Storages::Storage.extract_part_from_piped_string(new_health_reason, 0)enddiff --git a/modules/storages/app/workers/storages/health_status_mailer_job.rb b/modules/storages/app/workers/storages/health_status_mailer_job.rbindex ae715f5b2ed..a00c064f815 100644--- a/modules/storages/app/workers/storages/health_status_mailer_job.rb+++ b/modules/storages/app/workers/storages/health_status_mailer_job.rb@@ -30,6 +30,15 @@module Storagesclass HealthStatusMailerJob < ApplicationJob+ include GoodJob::ActiveJobExtensions::Concurrency++ good_job_control_concurrency_with(+ total_limit: 1,+ enqueue_limit: 1,+ perform_limit: 1,+ key: self.class.name+ )+def perform(storage:)return unless Storages::Storage.exists?(storage.id)@@ -56,7 +65,7 @@ module Storagesdef admin_usersUser.where(admin: true)- .where.not(mail: [nil, ''])+ .where.not(mail: [nil, ""])endendend