mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 16:38:23 +00:00
38 lines
1 KiB
Ruby
38 lines
1 KiB
Ruby
namespace :cache do
|
|
desc "Warm up all caches for deployment and healthchecks"
|
|
task warmup: :environment do
|
|
puts "Starting cache warmup for deployment..."
|
|
|
|
cache_jobs = [
|
|
Cache::CurrentlyHackingJob,
|
|
Cache::ActiveUsersGraphDataJob,
|
|
Cache::HomeStatsJob,
|
|
Cache::HeartbeatCountsJob,
|
|
Cache::ActiveProjectsJob,
|
|
Cache::MinutesLoggedJob,
|
|
Cache::SetupSocialProofJob,
|
|
Cache::UsageSocialProofJob
|
|
]
|
|
|
|
cache_jobs.each do |job_class|
|
|
puts "Running #{job_class.name}..."
|
|
begin
|
|
job_class.perform_now
|
|
puts "✓ #{job_class.name} completed"
|
|
rescue => e
|
|
puts "✗ #{job_class.name} failed: #{e.message}"
|
|
Sentry.capture_exception(e)
|
|
Rails.logger.error("Cache warmup failed for #{job_class.name}: #{e.class.name} #{e.message}")
|
|
end
|
|
end
|
|
|
|
puts "Cache warmup completed!"
|
|
end
|
|
|
|
desc "Clear all application caches"
|
|
task clear: :environment do
|
|
puts "Clearing all application caches..."
|
|
Rails.cache.clear
|
|
puts "✓ All caches cleared"
|
|
end
|
|
end
|