diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-08-28 15:43:46 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-08-28 15:43:46 +0100 |
commit | d801fff4325a42f1bbbb273ac0a4597c32b4dd4b (patch) | |
tree | 5b9d4828b2c6bf8415ccabb0140eb730ed12ceca /lib/tasks/cleanup.rake | |
parent | 0b511943ef5a8835af34842291725d1dce74b25a (diff) | |
parent | 533f0ab5f402e110f42d50fb6906a6b58ae312f7 (diff) |
Merge remote-tracking branch 'origin/release/0.19'0.19
Diffstat (limited to 'lib/tasks/cleanup.rake')
-rw-r--r-- | lib/tasks/cleanup.rake | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/tasks/cleanup.rake b/lib/tasks/cleanup.rake new file mode 100644 index 000000000..9a8be9521 --- /dev/null +++ b/lib/tasks/cleanup.rake @@ -0,0 +1,20 @@ +namespace :cleanup do + + desc 'Clean up all message redelivery and destroy actions from the holding pen to make admin actions there faster' + task :holding_pen => :environment do + dryrun = ENV['DRYRUN'] != '0' + if dryrun + $stderr.puts "This is a dryrun - nothing will be deleted" + end + holding_pen = InfoRequest.find_by_url_title('holding_pen') + old_events = holding_pen.info_request_events.find_each(:conditions => ['event_type in (?)', + ['redeliver_incoming', + 'destroy_incoming']]) do |event| + puts event.inspect + if ! dryrun + event.destroy + end + end + end + +end |