Downtime::DowntimesExpireTimerHandler: don't copy vector

`ConfigType::GetObjectsByType<Downtime>()` already returns a
`std::vector<Downtime::Ptr>` so there is no point in copying it into another
vector of the same type just to then iterate the copied vector instead of the
original one.
This commit is contained in:
Julian Brost 2021-12-01 13:05:23 +01:00
parent d6a1757cb8
commit 596fcdc123

View File

@ -482,13 +482,7 @@ void Downtime::DowntimesStartTimerHandler()
void Downtime::DowntimesExpireTimerHandler()
{
std::vector<Downtime::Ptr> downtimes;
for (const Downtime::Ptr& downtime : ConfigType::GetObjectsByType<Downtime>()) {
downtimes.push_back(downtime);
}
for (const Downtime::Ptr& downtime : downtimes) {
/* Only remove downtimes which are activated after daemon start. */
if (downtime->IsActive() && (downtime->IsExpired() || !downtime->HasValidConfigOwner()))
RemoveDowntime(downtime->GetName(), false, false, true);