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
Made ManagenextcloudIntegrationJob emit health events
Andreas Pfohl7a0572a85621
diff --git a/modules/storages/app/workers/storages/manage_nextcloud_integration_job.rb b/modules/storages/app/workers/storages/manage_nextcloud_integration_job.rbindex e9616253014..93484254b98 100644--- a/modules/storages/app/workers/storages/manage_nextcloud_integration_job.rb+++ b/modules/storages/app/workers/storages/manage_nextcloud_integration_job.rb@@ -38,14 +38,14 @@ module Storageskey: "ManageNextcloudIntegrationJob")SINGLE_THREAD_DEBOUNCE_TIME = 4.seconds.freeze- KEY = :manage_nextcloud_integration_job_debounce_happend_at- CRON_JOB_KEY = :'Storages::ManageNextcloudIntegrationJob'+ KEY = :manage_nextcloud_integration_job_debounce_happened_at+ CRON_JOB_KEY = :"Storages::ManageNextcloudIntegrationJob"queue_with_priority :above_normalclass << selfdef debounce- if debounce_happend_in_current_thread_recently?+ if debounce_happened_in_current_thread_recently?falseelse# TODO:@@ -73,7 +73,7 @@ module Storagesprivate- def debounce_happend_in_current_thread_recently?+ def debounce_happened_in_current_thread_recently?timestamp = RequestStore.store[KEY]timestamp.present? && (timestamp + SINGLE_THREAD_DEBOUNCE_TIME) > Time.currentend@@ -85,8 +85,10 @@ module Storagesresult = service_for(storage).call(storage)result.match(- on_success: ->(_) { storage.mark_as_healthy },- on_failure: ->(errors) { storage.mark_as_unhealthy(reason: errors.to_s) }+ on_success: ->(_) { OpenProject::Notifications.send(OpenProject::Events::STORAGE_TURNED_HEALTHY, storage:) },+ on_failure: ->(errors) do+ OpenProject::Notifications.send(OpenProject::Events::STORAGE_TURNED_UNHEALTHY, storage:, reason: errors.to_s)+ end)endend@@ -104,7 +106,7 @@ module Storagesreturn NextcloudGroupFolderPropertiesSyncService if storage.provider_type_nextcloud?return OneDriveManagedFolderSyncService if storage.provider_type_one_drive?- raise 'Unknown Storage'+ raise "Unknown Storage"endendend