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