cartodb-4.42/lib/tasks/data_import_log_expiration.rake

15 lines
470 B
Ruby
Raw Normal View History

2024-04-06 13:25:13 +08:00
namespace :dataimport do
namespace :log do
desc 'Set expiration of DataImport logs to 2 days'
task :set_expiration => :environment do
redis = $redis_migrator_logs || Redis.new
two_days_secs = 3600 * 24 * 2
block = lambda { |key| redis.expire(key, two_days_secs) }
redis.keys("*importer:log:*").each(&block)
redis.keys("*importer:entry:*").each(&block)
end # set_expiration
end # log
end # dataimport