mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 15:44:11 +02:00
[Refactor] l_LegacyDowntimesCache: store Downtime objects, not just their names
to avoid names of vanished objects.
This commit is contained in:
parent
bf24477638
commit
5a155346e7
@ -15,7 +15,7 @@ using namespace icinga;
|
|||||||
|
|
||||||
static int l_NextDowntimeID = 1;
|
static int l_NextDowntimeID = 1;
|
||||||
static std::mutex l_DowntimeMutex;
|
static std::mutex l_DowntimeMutex;
|
||||||
static std::map<int, String> l_LegacyDowntimesCache;
|
static std::map<int, Downtime::Ptr> l_LegacyDowntimesCache;
|
||||||
static Timer::Ptr l_DowntimesExpireTimer;
|
static Timer::Ptr l_DowntimesExpireTimer;
|
||||||
static Timer::Ptr l_DowntimesStartTimer;
|
static Timer::Ptr l_DowntimesStartTimer;
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ void Downtime::Start(bool runtimeCreated)
|
|||||||
std::unique_lock<std::mutex> lock(l_DowntimeMutex);
|
std::unique_lock<std::mutex> lock(l_DowntimeMutex);
|
||||||
|
|
||||||
SetLegacyId(l_NextDowntimeID);
|
SetLegacyId(l_NextDowntimeID);
|
||||||
l_LegacyDowntimesCache[l_NextDowntimeID] = GetName();
|
l_LegacyDowntimesCache[l_NextDowntimeID] = this;
|
||||||
l_NextDowntimeID++;
|
l_NextDowntimeID++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,7 +479,7 @@ String Downtime::GetDowntimeIDFromLegacyID(int id)
|
|||||||
if (it == l_LegacyDowntimesCache.end())
|
if (it == l_LegacyDowntimesCache.end())
|
||||||
return Empty;
|
return Empty;
|
||||||
|
|
||||||
return it->second;
|
return it->second->GetName();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Downtime::DowntimesStartTimerHandler()
|
void Downtime::DowntimesStartTimerHandler()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user