From 02ddff84f48d2f603e5ab0aa1953fe8b69206f5d Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 26 Feb 2026 10:58:19 +0100 Subject: [PATCH] SlaReport: Disconnect from the database when done This hook usually runs isolated and no-one else requires a connection. Makes only a difference in case of reporting triggering this as part of a scheduled report and prevents the database connection from being left open unnecessarily and failing upon re-use. (cherry picked from commit e56d8a68caee5d001970630b2f24f8ed9f66c5d9) --- library/Icingadb/ProvidedHook/Reporting/SlaReport.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/library/Icingadb/ProvidedHook/Reporting/SlaReport.php b/library/Icingadb/ProvidedHook/Reporting/SlaReport.php index 8dcc64e4..89986d6e 100644 --- a/library/Icingadb/ProvidedHook/Reporting/SlaReport.php +++ b/library/Icingadb/ProvidedHook/Reporting/SlaReport.php @@ -127,6 +127,11 @@ abstract class SlaReport extends ReportHook $rd->setRows($rows); + // Disconnect from the database, as this hook usually runs isolated and no-one else requires a connection. + // Makes only a difference in case of reporting triggering this as part of a scheduled report and prevents + // the database connection from being left open unnecessarily and failing upon re-use. + $this->getDb()->disconnect(); + return $rd; }