Skip to content

Commit

Permalink
fix flush beeing called in a wrong place
Browse files Browse the repository at this point in the history
Signed-off-by: Stepan Blyschak <stepanb@nvidia.com>
  • Loading branch information
stepanblyschak committed Nov 8, 2022
1 parent d176722 commit dfd360d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
10 changes: 5 additions & 5 deletions orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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();
}
}


Expand Down
8 changes: 1 addition & 7 deletions orchagent/response_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#include <string>
#include <vector>

#include <swss/json.h>

#include "timestamp.h"

extern bool gResponsePublisherRecord;
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit dfd360d

Please sign in to comment.