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

[#55112] Rename Storages::ManageNextcloudIntegrationJob

Pavel Balashou6363263153a1
diff --git a/lib/tasks/cron.rake b/lib/tasks/cron.rake
index c821efa35c3..15fa97459ea 100644
--- a/lib/tasks/cron.rake
+++ b/lib/tasks/cron.rake
@@ -29,6 +29,6 @@
namespace "openproject:cron" do
desc "Ensure the cron-like background jobs are properly unscheduled if needed"
task schedule: [:environment] do
- Storages::ManageNextcloudIntegrationJob.disable_cron_job_if_needed
+ Storages::ManageStorageIntegrationsJob.disable_cron_job_if_needed
end
end
diff --git a/modules/storages/app/workers/storages/manage_nextcloud_integration_job.rb b/modules/storages/app/workers/storages/manage_storage_integrations_job.rb
similarity index 95%
rename from modules/storages/app/workers/storages/manage_nextcloud_integration_job.rb
rename to modules/storages/app/workers/storages/manage_storage_integrations_job.rb
index 3ae88df231c..d753e791152 100644
--- a/modules/storages/app/workers/storages/manage_nextcloud_integration_job.rb
+++ b/modules/storages/app/workers/storages/manage_storage_integrations_job.rb
@@ -27,7 +27,7 @@
#++
module Storages
- class ManageNextcloudIntegrationJob < ApplicationJob
+ class ManageStorageIntegrationsJob < ApplicationJob
include GoodJob::ActiveJobExtensions::Concurrency
using ::Storages::Peripherals::ServiceResultRefinements
@@ -44,12 +44,11 @@ module Storages
good_job_control_concurrency_with(
total_limit: 2,
enqueue_limit: 1,
- perform_limit: 1,
- key: "ManageNextcloudIntegrationJob"
+ perform_limit: 1
)
SINGLE_THREAD_DEBOUNCE_TIME = 4.seconds.freeze
KEY = :manage_nextcloud_integration_job_debounce_happened_at
- CRON_JOB_KEY = :"Storages::ManageNextcloudIntegrationJob"
+ CRON_JOB_KEY = :"Storages::ManageStorageIntegrationsJob"
queue_with_priority :above_normal
diff --git a/modules/storages/lib/open_project/storages/engine.rb b/modules/storages/lib/open_project/storages/engine.rb
index 49e1121842c..489da74187a 100644
--- a/modules/storages/lib/open_project/storages/engine.rb
+++ b/modules/storages/lib/open_project/storages/engine.rb
@@ -62,7 +62,7 @@ module OpenProject::Storages
OpenProject::Events::PROJECT_UNARCHIVED
].each do |event|
OpenProject::Notifications.subscribe(event) do |_payload|
- ::Storages::ManageNextcloudIntegrationJob.debounce
+ ::Storages::ManageStorageIntegrationsJob.debounce
end
end
@@ -70,7 +70,7 @@ module OpenProject::Storages
OpenProject::Events::OAUTH_CLIENT_TOKEN_CREATED
) do |payload|
if payload[:integration_type] == "Storages::Storage"
- ::Storages::ManageNextcloudIntegrationJob.debounce
+ ::Storages::ManageStorageIntegrationsJob.debounce
end
end
@@ -78,7 +78,7 @@ module OpenProject::Storages
OpenProject::Events::ROLE_UPDATED
) do |payload|
if payload[:permissions_diff]&.intersect?(OpenProject::Storages::Engine.permissions)
- ::Storages::ManageNextcloudIntegrationJob.debounce
+ ::Storages::ManageStorageIntegrationsJob.debounce
end
end
@@ -86,7 +86,7 @@ module OpenProject::Storages
OpenProject::Events::ROLE_DESTROYED
) do |payload|
if payload[:permissions]&.intersect?(OpenProject::Storages::Engine.permissions)
- ::Storages::ManageNextcloudIntegrationJob.debounce
+ ::Storages::ManageStorageIntegrationsJob.debounce
end
end
@@ -97,8 +97,8 @@ module OpenProject::Storages
].each do |event|
OpenProject::Notifications.subscribe(event) do |payload|
if payload[:project_folder_mode] == :automatic
- ::Storages::ManageNextcloudIntegrationJob.debounce
- ::Storages::ManageNextcloudIntegrationJob.disable_cron_job_if_needed
+ ::Storages::ManageStorageIntegrationsJob.debounce
+ ::Storages::ManageStorageIntegrationsJob.disable_cron_job_if_needed
end
end
end
@@ -331,9 +331,9 @@ module OpenProject::Storages
class: ::Storages::CleanupUncontaineredFileLinksJob.name
},
- "Storages::ManageNextcloudIntegrationJob": {
+ "Storages::ManageStorageIntegrationsJob": {
cron: "1 * * * *", # every hour at xx:01
- class: ::Storages::ManageNextcloudIntegrationJob.name
+ class: ::Storages::ManageStorageIntegrationsJob.name
}
}
end
diff --git a/modules/storages/spec/workers/storages/manage_nextcloud_integration_job_spec.rb b/modules/storages/spec/workers/storages/manage_storage_integrations_job_spec.rb
similarity index 96%
rename from modules/storages/spec/workers/storages/manage_nextcloud_integration_job_spec.rb
rename to modules/storages/spec/workers/storages/manage_storage_integrations_job_spec.rb
index aecea8f61d3..cb46183921d 100644
--- a/modules/storages/spec/workers/storages/manage_nextcloud_integration_job_spec.rb
+++ b/modules/storages/spec/workers/storages/manage_storage_integrations_job_spec.rb
@@ -31,7 +31,7 @@
require "spec_helper"
require_module_spec_helper
-RSpec.describe Storages::ManageNextcloudIntegrationJob, :webmock, type: :job do
+RSpec.describe Storages::ManageStorageIntegrationsJob, :webmock, type: :job do
describe ".debounce" do
context "when has been debounced by other thread" do
before { ActiveJob::Base.disable_test_adapter }
@@ -76,7 +76,7 @@ RSpec.describe Storages::ManageNextcloudIntegrationJob, :webmock, type: :job do
good_job_setting = GoodJob::Setting.first
expect(good_job_setting.key).to eq("cron_keys_disabled")
- expect(good_job_setting.value).to eq(["Storages::ManageNextcloudIntegrationJob"])
+ expect(good_job_setting.value).to eq(["Storages::ManageStorageIntegrationsJob"])
expect { subject }.not_to change(GoodJob::Setting, :count).from(1)
@@ -100,7 +100,7 @@ RSpec.describe Storages::ManageNextcloudIntegrationJob, :webmock, type: :job do
good_job_setting = GoodJob::Setting.first
expect(good_job_setting.key).to eq("cron_keys_disabled")
- expect(good_job_setting.value).to eq(["Storages::ManageNextcloudIntegrationJob"])
+ expect(good_job_setting.value).to eq(["Storages::ManageStorageIntegrationsJob"])
end
end
end
diff --git a/spec/controllers/roles_controller_spec.rb b/spec/controllers/roles_controller_spec.rb
index ef52683f50d..031a694741d 100644
--- a/spec/controllers/roles_controller_spec.rb
+++ b/spec/controllers/roles_controller_spec.rb
@@ -387,7 +387,7 @@ RSpec.describe RolesController do
subject
expect(enqueued_jobs.count).to eq(1)
- expect(enqueued_jobs[0][:job]).to eq(Storages::ManageNextcloudIntegrationJob)
+ expect(enqueued_jobs[0][:job]).to eq(Storages::ManageStorageIntegrationsJob)
expect(response).to redirect_to roles_path
expect(Role.count).to eq(0)
end
diff --git a/spec/lib/open_project/events_spec.rb b/spec/lib/open_project/events_spec.rb
index 14d968e6e06..da7d20b7251 100644
--- a/spec/lib/open_project/events_spec.rb
+++ b/spec/lib/open_project/events_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe OpenProject::Events do
end
before do
- allow(Storages::ManageNextcloudIntegrationJob).to receive(:debounce)
+ allow(Storages::ManageStorageIntegrationsJob).to receive(:debounce)
end
%w[
@@ -53,7 +53,7 @@ RSpec.describe OpenProject::Events do
it do
subject
- expect(Storages::ManageNextcloudIntegrationJob).not_to have_received(:debounce)
+ expect(Storages::ManageStorageIntegrationsJob).not_to have_received(:debounce)
end
end
@@ -62,13 +62,13 @@ RSpec.describe OpenProject::Events do
it do
subject
- expect(Storages::ManageNextcloudIntegrationJob).to have_received(:debounce)
+ expect(Storages::ManageStorageIntegrationsJob).to have_received(:debounce)
end
it do
- allow(Storages::ManageNextcloudIntegrationJob).to receive(:disable_cron_job_if_needed)
+ allow(Storages::ManageStorageIntegrationsJob).to receive(:disable_cron_job_if_needed)
subject
- expect(Storages::ManageNextcloudIntegrationJob).to have_received(:disable_cron_job_if_needed)
+ expect(Storages::ManageStorageIntegrationsJob).to have_received(:disable_cron_job_if_needed)
end
end
end
@@ -90,7 +90,7 @@ RSpec.describe OpenProject::Events do
it do
subject
- expect(Storages::ManageNextcloudIntegrationJob).to have_received(:debounce)
+ expect(Storages::ManageStorageIntegrationsJob).to have_received(:debounce)
end
end
end
@@ -103,7 +103,7 @@ RSpec.describe OpenProject::Events do
it do
subject
- expect(Storages::ManageNextcloudIntegrationJob).not_to have_received(:debounce)
+ expect(Storages::ManageStorageIntegrationsJob).not_to have_received(:debounce)
end
end
@@ -112,7 +112,7 @@ RSpec.describe OpenProject::Events do
it do
subject
- expect(Storages::ManageNextcloudIntegrationJob).to have_received(:debounce)
+ expect(Storages::ManageStorageIntegrationsJob).to have_received(:debounce)
end
end
end
@@ -125,7 +125,7 @@ RSpec.describe OpenProject::Events do
it do
subject
- expect(Storages::ManageNextcloudIntegrationJob).not_to have_received(:debounce)
+ expect(Storages::ManageStorageIntegrationsJob).not_to have_received(:debounce)
end
end
@@ -134,7 +134,7 @@ RSpec.describe OpenProject::Events do
it do
subject
- expect(Storages::ManageNextcloudIntegrationJob).to have_received(:debounce)
+ expect(Storages::ManageStorageIntegrationsJob).to have_received(:debounce)
end
end
end
@@ -147,7 +147,7 @@ RSpec.describe OpenProject::Events do
it do
subject
- expect(Storages::ManageNextcloudIntegrationJob).not_to have_received(:debounce)
+ expect(Storages::ManageStorageIntegrationsJob).not_to have_received(:debounce)
end
end
@@ -156,7 +156,7 @@ RSpec.describe OpenProject::Events do
it do
subject
- expect(Storages::ManageNextcloudIntegrationJob).to have_received(:debounce)
+ expect(Storages::ManageStorageIntegrationsJob).to have_received(:debounce)
end
end
end