diff --git a/orchagent/orchdaemon.cpp b/orchagent/orchdaemon.cpp index f01a6ded7a49..9b533676ceb5 100644 --- a/orchagent/orchdaemon.cpp +++ b/orchagent/orchdaemon.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include "orchdaemon.h" #include "logger.h" @@ -645,6 +646,8 @@ void OrchDaemon::start() m_select->addSelectables(o->getSelectables()); } + auto tstart = std::chrono::high_resolution_clock::now(); + while (true) { Selectable *s; @@ -652,6 +655,17 @@ void OrchDaemon::start() ret = m_select->select(&s, SELECT_TIMEOUT); + auto tend = std::chrono::high_resolution_clock::now(); + + auto diff = std::chrono::duration_cast(tend - tstart); + + if (diff.count() >= SELECT_TIMEOUT) + { + tstart = std::chrono::high_resolution_clock::now(); + + flush(); + } + if (ret == Select::ERROR) { SWSS_LOG_NOTICE("Error: %s!\n", strerror(errno));