From 509db4ab9463607709fd7712a97922c91d77a5e2 Mon Sep 17 00:00:00 2001
From: Julian Brost <julian.brost@icinga.com>
Date: Tue, 19 Jan 2021 09:43:12 +0100
Subject: [PATCH] Delay start of IcingaDB until most config objects are
 activated

This commit sets the activation priority if IcingaDB objects to 100 (the
same value as IDO uses) so that it get's activated after most regular
config objects (hosts, services, ...).

Before (note how Icinga 2 continues to active objects for over a minute
after IcingaDB is started and thinks the initial dump is done):

    [2021-01-19 08:33:19 +0000] information/IcingaDB: 'icingadb' started.
    [2021-01-19 08:34:02 +0000] information/IcingaDB: Initial config/status dump finished in 28.247 seconds.
    [2021-01-19 08:35:49 +0000] information/ConfigItem: Activated all objects.

After (now activation of objects is done right after IcingaDB is
started, as it's one of the last objects to be activated):

    [2021-01-19 08:39:01 +0000] information/IcingaDB: 'icingadb' started.
    [2021-01-19 08:39:02 +0000] information/ConfigItem: Activated all objects.
    [2021-01-19 08:39:38 +0000] information/IcingaDB: Initial config/status dump finished in 21.6606 seconds.
---
 lib/icingadb/icingadb.ti | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/icingadb/icingadb.ti b/lib/icingadb/icingadb.ti
index c62bb4532..f6e593a9a 100644
--- a/lib/icingadb/icingadb.ti
+++ b/lib/icingadb/icingadb.ti
@@ -9,6 +9,8 @@ namespace icinga
 
 class IcingaDB : ConfigObject
 {
+	activation_priority 100;
+
 	[config] String host {
 		default {{{ return "127.0.0.1"; }}}
 	};