Skip to content

Commit

Permalink
VmdbMetric::Purging normalization
Browse files Browse the repository at this point in the history
- converted put_or_update to put on general queue
- allow multiple inserts into the queue

NOTE: this is still not a typical purger
  • Loading branch information
kbrock committed Apr 7, 2017
1 parent ce61ca2 commit a84c909
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
11 changes: 4 additions & 7 deletions app/models/vmdb_metric/purging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,11 @@ def purge_hourly_timer(ts = nil)
end

def purge_timer(value, interval)
MiqQueue.put_unless_exists(
MiqQueue.put(
:class_name => name,
:method_name => "purge_#{interval}",
:role => "database_operations",
:queue_name => "generic",
) do |_msg, find_options|
find_options.merge(:args => [value])
end
:args => [value]
)
end

def purge_window_size
Expand All @@ -59,7 +56,7 @@ def purge_daily(older_than, window = nil, &block)
# queue is calling purge_interval directly. (and mode is no longer used)
# keeping around in case messages are in the queue for upgrades
def purge(_mode, older_than, interval, window = nil, &block)
send("purge_#{interval}", older_than, window, &block)
purge_by_date(older_than, interval, window, &block)
end

private
Expand Down
1 change: 0 additions & 1 deletion spec/models/vmdb_metric_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
it "should purge" do
expect do
VmdbMetric.purge_daily_timer
VmdbMetric.purge_daily_timer
end.to change { MiqQueue.count }.by(1)
end
end

0 comments on commit a84c909

Please sign in to comment.