Skip to content
Snippets Groups Projects
Unverified Commit 7a94f3c3 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

clean and rebuild + comment

parent 22a43cc3
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ module Communication::Website::WithConnectedObjects
after_save :connect_about, if: :saved_change_to_about_id?
end
def rebuild_connections_and_git_files
def clean_and_rebuild
pages.find_each(&:connect_dependencies)
posts.find_each(&:connect_dependencies)
categories.find_each(&:connect_dependencies)
......@@ -20,7 +20,7 @@ module Communication::Website::WithConnectedObjects
sync_with_git_without_delay
destroy_obsolete_git_files_without_delay
end
handle_asynchronously :rebuild_connections_and_git_files, queue: :low_priority
handle_asynchronously :clean_and_rebuild, queue: :low_priority
# Appelé
# - par un objet avec des connexions lorsqu'il est destroyed
......
......@@ -4,7 +4,7 @@
"command": "0 1 * * * rails auto:update_publications_from_hal"
},
{
"command": "0 3 * * * rails auto:save_and_sync_websites"
"command": "0 3 * * * rails auto:clean_and_rebuild_websites"
}
]
}
\ No newline at end of file
......@@ -2,13 +2,15 @@ namespace :auto do
desc 'Update publications from HAL for all researchers'
task update_hal: :environment do
# Research::Hal.update_from_api! is synchronous, we use a job for that
Research::Hal::UpdateJob.perform_later
end
desc 'Resave every website to enable publications in the future'
task save_and_sync_websites: :environment do
desc 'Clean and rebuild every website to enable publications in the future'
task clean_and_rebuild_websites: :environment do
Communication::Website.find_each do |website|
website.rebuild_connections_and_git_files
# Communication::Website#clean_and_rebuild is asynchronous, no need for a intermediate job
website.clean_and_rebuild
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment