Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[teamsyncd][teammgrd] Graceful exit after receiving SIGTERM #1407

Merged
merged 3 commits into from
Sep 4, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cfgmgr/teammgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ int main(int argc, char **argv)
{
teammgr.cleanTeamProcesses(SIGTERM);
received_sigterm = false;
break;
}

Selectable *sel;
Expand All @@ -91,6 +92,7 @@ int main(int argc, char **argv)
auto *c = (Executor *)sel;
c->execute();
}
SWSS_LOG_NOTICE("Exiting");
}
catch (const exception &e)
{
Expand Down
7 changes: 6 additions & 1 deletion teamsyncd/teamsyncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,18 @@ int main(int argc, char **argv)
if(received_sigterm)
{
sync.cleanTeamSync();
received_sigterm = false;
break;
}

Selectable *temps;
s.select(&temps, 1000); // block for a second
sync.periodic();
}
if(received_sigterm)
{
SWSS_LOG_NOTICE("Received SIGTERM Exiting");
break;
}
}
catch (const std::exception& e)
{
Expand Down