blob: f0c4836e4e785cbeaed855a83bfc72dfe77cf698 (
plain)
1
2
3
4
5
6
7
8
9
10
|
namespace :ecs do
desc "Delete outtimed anonymous participants."
task :gc_anonymous_participants => :environment do
num= Participant.find(:all, :conditions => ["(anonymous = ?) AND (ttl < ?)", true, DateTime.now.utc]).length
Participant.destroy_all(["(anonymous = ?) AND (ttl < ?)", true, DateTime.now.utc])
txt= "Number of deleted messages: #{num}"
puts txt
RAILS_DEFAULT_LOGGER.info txt
end
end
|