Skip to content

Commit

Permalink
Merge pull request #9793 from Icinga/unmarshal-number-42-5-into-go-st…
Browse files Browse the repository at this point in the history
…ruct-field-notification-notification_interval

IcingaDB::PrepareObject(): round Notification#interval and limit it to >=0
  • Loading branch information
julianbrost committed Jun 27, 2023
2 parents 5350aa3 + 273aa6f commit bd11bc2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/icingadb/icingadb-objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "remote/zone.hpp"
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdint>
#include <iterator>
#include <map>
Expand Down Expand Up @@ -1388,7 +1389,7 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a
attributes->Set("times_end",notification->GetTimes()->Get("end"));
}

attributes->Set("notification_interval", notification->GetInterval());
attributes->Set("notification_interval", std::max(0.0, std::round(notification->GetInterval())));
attributes->Set("states", notification->GetStates());
attributes->Set("types", notification->GetTypes());

Expand Down

0 comments on commit bd11bc2

Please sign in to comment.