Handle SIGTERM and gracefully shut-down.

This commit is contained in:
Kishore Nallan 2018-03-07 07:25:33 +05:30
parent 0f9c97eaf3
commit 928b5602de
2 changed files with 6 additions and 1 deletions

View File

@ -95,7 +95,7 @@
- ~~Replica server should fail when pointed to "old" master~~
- ~~gzip compress responses~~
- ~~Have a LOG(ERROR) level~~
- Handle SIGTERM which is sent when process is killed
- ~~Handle SIGTERM which is sent when process is killed~~
- Parameterize replica's MAX_UPDATES_TO_SEND
- NOT operator support
- > INT32_MAX validation for float field

View File

@ -64,7 +64,12 @@ void replica_server_routes() {
}
int main(int argc, char **argv) {
// remove SIGTERM since we handle it on our own
g3::overrideSetupSignals({{SIGABRT, "SIGABRT"}, {SIGFPE, "SIGFPE"},{SIGILL, "SIGILL"}, {SIGSEGV, "SIGSEGV"},});
// we can install new signal handlers only after overriding above
signal(SIGINT, catch_interrupt);
signal(SIGTERM, catch_interrupt);
cmdline::parser options;
options.add<std::string>("data-dir", 'd', "Directory where data will be stored.", true);