Improve latency after start-up.

Fixes #5121
This commit is contained in:
Gunnar Beutner 2013-11-21 16:09:21 +01:00
parent 7a79886922
commit 45161fe66d
4 changed files with 10 additions and 22 deletions

View File

@ -233,6 +233,7 @@ void IdoMysqlConnection::ClearConfigTables(void)
{
/* TODO make hardcoded table names modular */
ClearConfigTable("commands");
ClearConfigTable("comments");
ClearConfigTable("contact_addresses");
ClearConfigTable("contact_notificationcommands");
ClearConfigTable("contactgroup_members");
@ -246,6 +247,7 @@ void IdoMysqlConnection::ClearConfigTables(void)
ClearConfigTable("hostgroup_members");
ClearConfigTable("hostgroups");
ClearConfigTable("hosts");
ClearConfigTable("scheduleddowntime");
ClearConfigTable("service_contactgroups");
ClearConfigTable("service_contacts");
ClearConfigTable("servicedependencies");

View File

@ -237,6 +237,7 @@ void IdoPgsqlConnection::ClearConfigTables(void)
{
/* TODO make hardcoded table names modular */
ClearConfigTable("commands");
ClearConfigTable("comments");
ClearConfigTable("contact_addresses");
ClearConfigTable("contact_notificationcommands");
ClearConfigTable("contactgroup_members");
@ -250,6 +251,7 @@ void IdoPgsqlConnection::ClearConfigTables(void)
ClearConfigTable("hostgroup_members");
ClearConfigTable("hostgroups");
ClearConfigTable("hosts");
ClearConfigTable("scheduleddowntime");
ClearConfigTable("service_contactgroups");
ClearConfigTable("service_contacts");
ClearConfigTable("servicedependencies");

View File

@ -211,14 +211,6 @@ void ServiceDbObject::OnConfigUpdate(void)
/* service dependencies */
Log(LogDebug, "db_ido", "service dependencies for '" + service->GetName() + "'");
DbQuery query_del1;
query_del1.Table = GetType()->GetTable() + "dependencies";
query_del1.Type = DbQueryDelete;
query_del1.Category = DbCatConfig;
query_del1.WhereCriteria = make_shared<Dictionary>();
query_del1.WhereCriteria->Set("dependent_service_object_id", service);
OnQuery(query_del1);
BOOST_FOREACH(const Service::Ptr& parent, service->GetParentServices()) {
Log(LogDebug, "db_ido", "service parents: " + parent->GetName());
@ -276,14 +268,6 @@ void ServiceDbObject::OnConfigUpdate(void)
/* custom variables */
Log(LogDebug, "db_ido", "service customvars for '" + service->GetName() + "'");
DbQuery query_del2;
query_del2.Table = "customvariables";
query_del2.Type = DbQueryDelete;
query_del2.Category = DbCatConfig;
query_del2.WhereCriteria = make_shared<Dictionary>();
query_del2.WhereCriteria->Set("object_id", service);
OnQuery(query_del2);
Dictionary::Ptr customvars;
{
@ -292,7 +276,7 @@ void ServiceDbObject::OnConfigUpdate(void)
}
if (customvars) {
ObjectLock olock (customvars);
ObjectLock olock(customvars);
String key;
Value value;
@ -317,8 +301,6 @@ void ServiceDbObject::OnConfigUpdate(void)
}
/* update comments and downtimes on config change */
RemoveComments(service);
RemoveDowntimes(service);
AddComments(service);
AddDowntimes(service);

View File

@ -48,9 +48,6 @@ void Service::Start(void)
VERIFY(GetHost());
SetSchedulingOffset(Utility::Random());
UpdateNextCheck();
AddDowntimesToCache();
AddCommentsToCache();
@ -78,6 +75,11 @@ void Service::OnConfigLoaded(void)
m_Host->AddService(GetSelf());
UpdateSlaveNotifications();
SetSchedulingOffset(Utility::Random());
if (GetNextCheck() < Utility::GetTime() + 300)
SetNextCheck(Utility::GetTime() + Utility::Random() % 300);
}
Service::Ptr Service::GetByNamePair(const String& hostName, const String& serviceName)