From 82a3afd11def66e6aba1967e74773b6a45f45201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Luka=C5=A1=C3=ADk?= Date: Tue, 11 Apr 2017 12:50:55 +0200 Subject: [PATCH] Do not run MiqEventDefinitionSet.seed twice on start-up We do not need to run this twice. We have a mechanism to set dependencies between the seeds. On my system, running `10.times { EvmDatabase.seed_last }` gives :sake: | rows | selects | time | % ------ | ---- | ------- | ---- | --- Before | ? | ? | 55s | 100% After | -130 | -130 | 51s | 91% --- app/models/miq_event_definition.rb | 1 - lib/evm_database.rb | 1 + spec/models/authentication_spec.rb | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/miq_event_definition.rb b/app/models/miq_event_definition.rb index 3e48cfc223c..a7d4f5d8f0d 100644 --- a/app/models/miq_event_definition.rb +++ b/app/models/miq_event_definition.rb @@ -117,7 +117,6 @@ def self.add_elements(_vm, xmlNode) end def self.seed - MiqEventDefinitionSet.seed seed_default_events seed_default_definitions end diff --git a/lib/evm_database.rb b/lib/evm_database.rb index 9d280a55890..4450501aff3 100644 --- a/lib/evm_database.rb +++ b/lib/evm_database.rb @@ -23,6 +23,7 @@ class EvmDatabase RssFeed MiqWidget MiqAction + MiqEventDefinitionSet MiqEventDefinition MiqPolicySet ChargebackRateDetailMeasure diff --git a/spec/models/authentication_spec.rb b/spec/models/authentication_spec.rb index e81b312ea88..99204a40355 100644 --- a/spec/models/authentication_spec.rb +++ b/spec/models/authentication_spec.rb @@ -8,6 +8,7 @@ context "with miq events seeded" do before(:each) do + MiqEventDefinitionSet.seed MiqEventDefinition.seed end