Delete lib/tasks/sitemap_cached.rake

This commit is contained in:
Daniel O'Connor
2025-12-02 01:10:06 +10:30
committed by GitHub
parent b34442b16b
commit 0054e7d868

View File

@@ -1,19 +0,0 @@
# frozen_string_literal: true
namespace :sitemap do
desc 'Generate sitemap, but only if it has not been generated in the last 72 hours'
task cached_refresh: :environment do
sitemap_file = Rails.root.join('tmp', 'sitemap_generated_at.txt')
if File.exist?(sitemap_file)
last_generated_at = Time.parse(File.read(sitemap_file))
if last_generated_at > 72.hours.ago
puts 'Sitemap has been generated within the last 72 hours. Skipping.'
exit
end
end
Rake::Task['sitemap:refresh'].invoke
File.write(sitemap_file, Time.now.to_s)
end
end