diff --git a/app/jobs/communication/website/base_job.rb b/app/jobs/communication/website/base_job.rb index d758e5d18d999c6e19367dc0b2376f149d5faf0d..5494fe46b2ff4df96fe881aab2cc3857bbe0ca4b 100644 --- a/app/jobs/communication/website/base_job.rb +++ b/app/jobs/communication/website/base_job.rb @@ -3,6 +3,8 @@ class Communication::Website::BaseJob < ApplicationJob queue_as :elephant + discard_on ActiveJob::DeserializationError + attr_accessor :website_id def perform(website_id) diff --git a/app/jobs/communication/website/delete_obsolete_connections_job.rb b/app/jobs/communication/website/delete_obsolete_connections_job.rb index 6cd27f55d11c9d9f8b057e724c86fd9033279d38..620708080a907df2c92720f875255c83bd31a3ff 100644 --- a/app/jobs/communication/website/delete_obsolete_connections_job.rb +++ b/app/jobs/communication/website/delete_obsolete_connections_job.rb @@ -1,4 +1,6 @@ class Communication::Website::DeleteObsoleteConnectionsJob < Communication::Website::BaseJob + queue_as :mice + def execute website.delete_obsolete_connections end diff --git a/app/jobs/communication/website/direct_object/sync_with_git_job.rb b/app/jobs/communication/website/direct_object/sync_with_git_job.rb index c7cb0bee46423f48754d910e4c95ec1d1096b9bc..b8fb27a952fa44b0da2ef2a14ad95d5666fbcab6 100644 --- a/app/jobs/communication/website/direct_object/sync_with_git_job.rb +++ b/app/jobs/communication/website/direct_object/sync_with_git_job.rb @@ -1,6 +1,4 @@ -class Communication::Website::DirectObject::SyncWithGitJob < ApplicationJob - queue_as :elephant - +class Communication::Website::DirectObject::SyncWithGitJob < Communication::Website::BaseJob def perform(direct_object) direct_object.sync_with_git_safely end diff --git a/app/jobs/communication/website/indirect_object/sync_with_git_job.rb b/app/jobs/communication/website/indirect_object/sync_with_git_job.rb index c3cb795dd044aa98efc42935fad2e1f182b40844..fb2ac66800dc7658e112ebc79f957959e4516072 100644 --- a/app/jobs/communication/website/indirect_object/sync_with_git_job.rb +++ b/app/jobs/communication/website/indirect_object/sync_with_git_job.rb @@ -1,6 +1,4 @@ -class Communication::Website::IndirectObject::SyncWithGitJob < ApplicationJob - queue_as :elephant - +class Communication::Website::IndirectObject::SyncWithGitJob < Communication::Website::BaseJob def perform(website, indirect_object) website.sync_indirect_object_with_git(indirect_object) end diff --git a/app/models/communication/website/with_git_repository.rb b/app/models/communication/website/with_git_repository.rb index e4518ccb9bacf0bee678ac763b80a2389a963026..30623f9e5530669657606ddf6c730042922069b1 100644 --- a/app/models/communication/website/with_git_repository.rb +++ b/app/models/communication/website/with_git_repository.rb @@ -47,6 +47,7 @@ module Communication::Website::WithGitRepository end def destroy_obsolete_git_files_safely + return unless should_sync_with_git? website_git_files.find_each do |git_file| dependency = git_file.about # Here, dependency can be nil (object was previously destroyed)