From 5a82e28f3ef52cb9082f2eaaa529e0bf4757dce0 Mon Sep 17 00:00:00 2001 From: Keenan Brock Date: Wed, 7 Dec 2016 11:11:50 -0500 Subject: [PATCH] Introduce report result purging timer The resources required for report result purging has been reduced, so make sure this is scheduled. https://bugzilla.redhat.com/show_bug.cgi?id=1348625 --- app/models/miq_schedule_worker/jobs.rb | 4 ++++ app/models/miq_schedule_worker/runner.rb | 6 ++++++ config/settings.yml | 1 + 3 files changed, 11 insertions(+) diff --git a/app/models/miq_schedule_worker/jobs.rb b/app/models/miq_schedule_worker/jobs.rb index 6455a69e502..f354f46b774 100644 --- a/app/models/miq_schedule_worker/jobs.rb +++ b/app/models/miq_schedule_worker/jobs.rb @@ -117,6 +117,10 @@ def policy_event_purge_timer queue_work(:class_name => "PolicyEvent", :method_name => "purge_timer", :zone => nil) end + def miq_report_result_purge_timer + queue_work(:class_name => "MiqReportResult", :method_name => "purge_timer", :zone => nil) + end + def storage_refresh_metrics queue_work( :class_name => "StorageManager", diff --git a/app/models/miq_schedule_worker/runner.rb b/app/models/miq_schedule_worker/runner.rb index c06882fd31d..a4884367efb 100644 --- a/app/models/miq_schedule_worker/runner.rb +++ b/app/models/miq_schedule_worker/runner.rb @@ -218,6 +218,12 @@ def schedules_for_scheduler_role enqueue :miq_alert_evaluate_hourly_timer end + # Schedule - Prune old reports Timer + every = worker_settings[:report_result_purge_interval] + scheduler.schedule_every(every, :first_in => every) do + enqueue :miq_report_result_purge_timer + end + # Schedule every 24 hours at = worker_setting_or_default(:storage_file_collection_time_utc) if Time.now.strftime("%Y-%m-%d #{at}").to_time(:utc) < Time.now.utc diff --git a/config/settings.yml b/config/settings.yml index d6ffa915da9..6b44215319f 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -1365,6 +1365,7 @@ :performance_rollup_purging_start_delay: 5.minutes :policy_events_purge_interval: 1.day :poll: 15.seconds + :report_result_purge_interval: 1.week :server_log_stats_interval: 5.minutes :server_stats_interval: 60.seconds :service_retired_interval: 10.minutes