[dev.icinga.com #11423] Cleanup downtimes created by ScheduleDowntime #4048
This issue has been migrated from Redmine: https://dev.icinga.com/issues/11423
Created by mfrosch on 2016-03-21 08:16:39 +00:00
Should we cleanup downtimes that were generated by a ScheduledDowntime apply, when the apply does no longer exist?
2016-08-13 13:18:50 +00:00 by mfriedrich 8f03adf
2016-08-13 19:43:59 +00:00 by gbeutner 9f8cb8d
Updated by mfriedrich on 2016-08-13 13:21:09 +00:00
Your comment isn't helpful at all.
Detecting this sort of deletion isn't as easy as it sounds. We'll have to wait until the downtime is fully loaded to check against the config_owner attribute and its reference to an actual ScheduledDowntime object. Such a thing could happen inside the expire handler for downtimes - mainly for the reason that ScheduledDowntime objects may also be created at runtime without any restart. Doing that inside Start() (calling Stop()) would lock.
The thing I don't like about my patch is that the expire interval is 60s which might just take a minute to see the change reflected in DB IDO and Icinga Web 2. Although until no-one comes up with a better one, I'll leave the fix as is. Make sure to fetch the snapshot packages and properly test the patch.