From dfd360d71b0238bb90a366eef803cf1b46e83d4c Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Tue, 8 Nov 2022 13:16:08 +0000 Subject: [PATCH] fix flush beeing called in a wrong place Signed-off-by: Stepan Blyschak --- orchagent/orchdaemon.cpp | 10 +++++----- orchagent/response_publisher.cpp | 8 +------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/orchagent/orchdaemon.cpp b/orchagent/orchdaemon.cpp index 4e91c2389a..58ed80264c 100644 --- a/orchagent/orchdaemon.cpp +++ b/orchagent/orchdaemon.cpp @@ -677,6 +677,11 @@ void OrchDaemon::flush() SWSS_LOG_ERROR("Failed to flush redis pipeline %d", status); abort(); } + + for (auto* orch: m_orchList) + { + orch->flushResponses(); + } } /* Release the file handle so the log can be rotated */ @@ -690,11 +695,6 @@ void OrchDaemon::logRotate() { { SWSS_LOG_ERROR("Failed to release the file handle on sairedis log %d", status); } - - for (auto* orch: m_orchList) - { - orch->flushResponses(); - } } diff --git a/orchagent/response_publisher.cpp b/orchagent/response_publisher.cpp index 978192740a..169075faa4 100644 --- a/orchagent/response_publisher.cpp +++ b/orchagent/response_publisher.cpp @@ -5,8 +5,6 @@ #include #include -#include - #include "timestamp.h" extern bool gResponsePublisherRecord; @@ -114,14 +112,10 @@ void ResponsePublisher::publish(const std::string &table, const std::string &key std::string response_channel = "APPL_DB_" + table + "_RESPONSE_CHANNEL"; swss::NotificationProducer notificationProducer{m_pipe.get(), response_channel, m_buffered}; - auto intent_attrs_copy = state_attrs; + auto intent_attrs_copy = intent_attrs; // Add error message as the first field-value-pair. swss::FieldValueTuple err_str("err_str", PrependedComponent(status) + status.message()); intent_attrs_copy.insert(intent_attrs_copy.begin(), err_str); - // Send state attrs - std::string state_attrs_serialized = swss::JSon::buildJson(state_attrs); - swss::FieldValueTuple state_attrs_fv("state_attrs", state_attrs_serialized); - intent_attrs_copy.insert(intent_attrs_copy.begin(), state_attrs_fv); // Sends the response to the notification channel. notificationProducer.send(status.codeStr(), key, intent_attrs_copy); RecordResponse(response_channel, key, intent_attrs_copy, status.codeStr());