summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0012-Add-support-for-deleting-terminated-subscriptions.patch
blob: 61503904c577d2543b40cff5cc7e1796ef63f2ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From b132263ef2f3bb3fd2766154c00b7b00c1e49fb6 Mon Sep 17 00:00:00 2001
From: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Date: Tue, 7 Dec 2021 09:48:07 +0100
Subject: [PATCH] Add support for deleting terminated subscriptions

Added functionality to delete/remove event subscription(s) which are
configured to Terminate after retries.

Currently, when an Event is subscribed with Retry Policy as
"TerminateAfterRetries", the state of the connection is set to
"Terminated" after retrying, but the Subscription is not removed.
This commit adds the functionality to detect terminated connection and
remove the respective subscription.

This commit adds this check for metric reports.

Tested:
 - Created a Subscription with
   DeliveryRetryPolicy: "TerminateAfterRetries"
 - Received Events successfully on Event listener
 - Once the Event listener was stopped, the Subscription was
   removed/deleted after retries.

Change-Id: I3cb0af5bc24411cddcdb3d1d9de25e8e9144106c
Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com>
---
 redfish-core/include/event_service_manager.hpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index c68b707..6a93fc0 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -1486,7 +1486,7 @@ class EventServiceManager
     }
 
 #endif
-    static void getReadingsForReport(sdbusplus::message::message& msg)
+    void getReadingsForReport(sdbusplus::message::message& msg)
     {
         if (msg.is_method_error())
         {
@@ -1525,6 +1525,8 @@ class EventServiceManager
             return;
         }
 
+        deleteTerminatedSubcriptions();
+
         for (const auto& it :
              EventServiceManager::getInstance().subscriptionsMap)
         {
@@ -1560,7 +1562,10 @@ class EventServiceManager
                                "arg0=xyz.openbmc_project.Telemetry.Report";
 
         matchTelemetryMonitor = std::make_shared<sdbusplus::bus::match::match>(
-            *crow::connections::systemBus, matchStr, getReadingsForReport);
+            *crow::connections::systemBus, matchStr,
+            [this](sdbusplus::message::message& msg) {
+                getReadingsForReport(msg);
+            });
     }
 };
 
-- 
2.25.1