Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce report result purging timer #13044

Merged
merged 1 commit into from
Dec 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/models/miq_schedule_worker/jobs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • nil zone
  • schedules_for_scheduler_role

This means the singular regional "scheduler" role schedule worker will run this and queue it for the deletion of old report results for the whole region. If you were concerned with who should run it, I think the above confirms you did it right.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note, I'm not sure how you could really test this cleanly

end

def storage_refresh_metrics
queue_work(
:class_name => "StorageManager",
Expand Down
6 changes: 6 additions & 0 deletions app/models/miq_schedule_worker/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,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_settings[:storage_file_collection_time_utc]
if Time.now.strftime("%Y-%m-%d #{at}").to_time(:utc) < Time.now.utc
Expand Down
1 change: 1 addition & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1393,6 +1393,7 @@
:policy_events_purge_interval: 1.day
:poll: 15.seconds
:resync_rhn_mirror: 12.hours
:report_result_purge_interval: 1.week
:server_log_stats_interval: 5.minutes
:server_stats_interval: 60.seconds
:service_retired_interval: 10.minutes
Expand Down