Update redbean shutdown to call OnServerStop when all shutdown/logging is done

This commit is contained in:
Paul Kulchenko 2022-07-22 18:11:58 -07:00
parent ffedbfe14d
commit fa4174a0ad

View file

@ -7058,6 +7058,7 @@ static void HandleShutdown(void) {
KillGroup();
}
WaitAll();
INFOF("(srvr) shutdown complete");
}
// this function coroutines with linenoise
@ -7371,15 +7372,6 @@ void RedBean(int argc, char *argv[]) {
ReplEventLoop();
}
#endif
if (!isexitingworker) {
HandleShutdown();
CallSimpleHookIfDefined("OnServerStop");
}
if (!IsTiny()) {
LuaDestroy();
TlsDestroy();
MemDestroy();
}
if (!isexitingworker) {
if (!IsTiny()) {
terminatemonitor = true;
@ -7388,9 +7380,13 @@ void RedBean(int argc, char *argv[]) {
#ifndef STATIC
_join(&replth);
#endif
HandleShutdown();
CallSimpleHookIfDefined("OnServerStop");
}
if (!isexitingworker) {
INFOF("(srvr) shutdown complete");
if (!IsTiny()) {
LuaDestroy();
TlsDestroy();
MemDestroy();
}
}