mirror of
https://github.com/Growstuff/growstuff.git
synced 2025-12-23 17:47:49 -05:00
Delete lib/tasks/sitemap_cached.rake
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user