This is an automated email from the ASF dual-hosted git repository.
twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new e0f4f6ea Improve the cleanup order in the main function (#1698)
e0f4f6ea is described below
commit e0f4f6ea19cc73aef48ba9ea3b8c5330c3baa1f4
Author: Twice <[email protected]>
AuthorDate: Fri Aug 25 11:16:12 2023 +0900
Improve the cleanup order in the main function (#1698)
---
src/main.cc | 5 ++++-
src/server/server.cc | 1 -
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/main.cc b/src/main.cc
index fc3b4611..4d8f8c22 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -309,8 +309,12 @@ static void Daemonize() {
int main(int argc, char *argv[]) {
srand(static_cast<unsigned>(util::GetTimeStamp()));
+
google::InitGoogleLogging("kvrocks");
+ auto glog_exit = MakeScopeExit(google::ShutdownGoogleLogging);
+
evthread_use_pthreads();
+ auto event_exit = MakeScopeExit(libevent_global_shutdown);
signal(SIGPIPE, SIG_IGN);
SetupSigSegvAction();
@@ -369,6 +373,5 @@ int main(int argc, char *argv[]) {
}
srv->Join();
- google::ShutdownGoogleLogging();
return 0;
}
diff --git a/src/server/server.cc b/src/server/server.cc
index 6ab3d018..b07821e7 100644
--- a/src/server/server.cc
+++ b/src/server/server.cc
@@ -116,7 +116,6 @@ Server::~Server() {
}
lua::DestroyState(lua_);
- libevent_global_shutdown();
}
// Kvrocks threads list: