Skip to content

Commit

Permalink
feat(cmd): add more information to shutdown log (#2672)
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice authored Nov 19, 2024
1 parent 88ac233 commit f98cb0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/cli/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Server *srv = nullptr;

extern "C" void SignalHandler([[maybe_unused]] int sig) {
if (srv && !srv->IsStopped()) {
LOG(INFO) << "Bye Bye";
LOG(INFO) << "Signal " << sig << " received, stopping the server";
srv->Stop();
}
}
Expand Down Expand Up @@ -116,6 +116,7 @@ static void InitGoogleLog(const Config *config) {

int main(int argc, char *argv[]) {
srand(static_cast<unsigned>(util::GetTimeStamp()));
crc64_init();

evthread_use_pthreads();
auto event_exit = MakeScopeExit(libevent_global_shutdown);
Expand All @@ -137,7 +138,6 @@ int main(int argc, char *argv[]) {
}
});

crc64_init();
InitGoogleLog(&config);
google::InitGoogleLogging("kvrocks");
auto glog_exit = MakeScopeExit(google::ShutdownGoogleLogging);
Expand Down
4 changes: 2 additions & 2 deletions src/commands/cmd_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ class CommandShutdown : public Commander {
}

if (!srv->IsStopped()) {
LOG(INFO) << "bye bye";
LOG(INFO) << "SHUTDOWN command received, stopping the server";
srv->Stop();
}
return Status::OK();
Expand Down Expand Up @@ -1344,7 +1344,7 @@ REDIS_REGISTER_COMMANDS(Server, MakeCmdAttr<CommandAuth>("auth", 2, "read-only o
MakeCmdAttr<CommandPerfLog>("perflog", -2, "read-only", NO_KEY),
MakeCmdAttr<CommandClient>("client", -2, "read-only", NO_KEY),
MakeCmdAttr<CommandMonitor>("monitor", 1, "read-only no-multi no-script", NO_KEY),
MakeCmdAttr<CommandShutdown>("shutdown", 1, "read-only no-multi no-script", NO_KEY),
MakeCmdAttr<CommandShutdown>("shutdown", 1, "read-only exclusive no-multi no-script", NO_KEY),
MakeCmdAttr<CommandQuit>("quit", 1, "read-only", NO_KEY),
MakeCmdAttr<CommandScan>("scan", -2, "read-only", NO_KEY),
MakeCmdAttr<CommandRandomKey>("randomkey", 1, "read-only", NO_KEY),
Expand Down

0 comments on commit f98cb0c

Please sign in to comment.