From a84c909e255f79c7b18ceab5148f896430a504c5 Mon Sep 17 00:00:00 2001 From: Keenan Brock Date: Thu, 6 Apr 2017 15:27:43 -0400 Subject: [PATCH] VmdbMetric::Purging normalization - converted put_or_update to put on general queue - allow multiple inserts into the queue NOTE: this is still not a typical purger --- app/models/vmdb_metric/purging.rb | 11 ++++------- spec/models/vmdb_metric_spec.rb | 1 - 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/models/vmdb_metric/purging.rb b/app/models/vmdb_metric/purging.rb index e65b568373e..250a7fe2af5 100644 --- a/app/models/vmdb_metric/purging.rb +++ b/app/models/vmdb_metric/purging.rb @@ -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 @@ -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 diff --git a/spec/models/vmdb_metric_spec.rb b/spec/models/vmdb_metric_spec.rb index e2881c21349..c6a8ea61eff 100644 --- a/spec/models/vmdb_metric_spec.rb +++ b/spec/models/vmdb_metric_spec.rb @@ -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