Cleanup build_lists with status canceling

This commit is contained in:
Vokhmin Alexey V 2014-01-31 21:12:24 +04:00
parent 9e4583459d
commit 6958c463c6
2 changed files with 30 additions and 7 deletions

View File

@ -1,29 +1,29 @@
#every 1.day, at: '0:05 am' do #every 1.day, at: '0:05 am' do
# runner "Download.rotate_nginx_log" # runner 'Download.rotate_nginx_log'
#end #end
# #
#every 1.day, at: '0:10 am' do #every 1.day, at: '0:10 am' do
# runner "Download.parse_and_remove_nginx_log" # runner 'Download.parse_and_remove_nginx_log'
#end #end
every :day, at: '4:10 am' do every :day, at: '4:10 am' do
rake "product_build_list:clear:outdated", output: 'log/product_build_list_clear.log' rake 'product_build_list:clear:outdated', output: 'log/product_build_list_clear.log'
end end
every :day, at: '4:00 am' do every :day, at: '4:00 am' do
rake "import:sync:all", output: 'log/sync.log' rake 'import:sync:all', output: 'log/sync.log'
end end
every :day, at: '3:50 am' do every :day, at: '3:50 am' do
rake "buildlist:clear:outdated", output: 'log/build_list_clear.log' rake 'buildlist:clear:outdated', output: 'log/build_list_clear.log'
end end
every :day, at: '3:30 am' do every :day, at: '3:30 am' do
rake "pull_requests:clear", output: 'log/pull_requests_clear.log' rake 'pull_requests:clear', output: 'log/pull_requests_clear.log'
end end
every :day, at: '3:00 am' do every :day, at: '3:00 am' do
rake "activity_feeds:clear", output: 'log/activity_feeds.log' rake 'activity_feeds:clear', output: 'log/activity_feeds.log'
end end
every 3.minute do every 3.minute do
@ -34,6 +34,10 @@ every 1.minute do
runner 'RpmBuildNode.cleanup!' runner 'RpmBuildNode.cleanup!'
end end
every 1.hour do
rake 'buildlist:clear:outdated_canceling', output: 'log/canceling_build_list_clear.log'
end
every :day, at: '4am' do every :day, at: '4am' do
runner 'Product.autostart_iso_builds_once_a_12_hours', output: 'log/autostart_iso_builds.log' runner 'Product.autostart_iso_builds_once_a_12_hours', output: 'log/autostart_iso_builds.log'
runner 'Product.autostart_iso_builds_once_a_day', output: 'log/autostart_iso_builds.log' runner 'Product.autostart_iso_builds_once_a_day', output: 'log/autostart_iso_builds.log'

View File

@ -24,6 +24,25 @@ namespace :buildlist do
say "[#{Time.zone.now}] Outdated BuildLists and MassBuilds was successfully removed" say "[#{Time.zone.now}] Outdated BuildLists and MassBuilds was successfully removed"
end end
desc 'Remove outdated BuildLists with status BUILD_CANCELING'
task outdated_canceling: :environment do
say "[#{Time.zone.now}] Removing outdated BuildLists"
scope = BuildList.for_status(BuildList::BUILD_CANCELING).
for_notified_date_period(nil, Time.zone.now - 3.hours)
say "[#{Time.zone.now}] There are #{scope.count} outdated BuildLists"
counter = 0
scope.find_each do |bl|
bl.destroy && (counter += 1)
end
say "[#{Time.zone.now}] #{counter} outdated BuildLists have been removed"
say "[#{Time.zone.now}] Outdated BuildLists were successfully removed"
end
end end
namespace :packages do namespace :packages do