mirror of
https://github.com/pockethost/pockethost.git
synced 2025-05-11 18:29:54 +00:00
enh: instance logging
This commit is contained in:
parent
224058bdf2
commit
961bc6e9c2
@ -176,13 +176,20 @@ export const instanceService = mkSingleton(
|
||||
return shutdownManager.shutdown()
|
||||
},
|
||||
}
|
||||
const _safeShutdown = async (reason?: Error) =>
|
||||
api.status() === InstanceApiStatus.ShuttingDown || api.shutdown(reason)
|
||||
const _safeShutdown = async (reason?: Error) => {
|
||||
if (api.status() === InstanceApiStatus.ShuttingDown) {
|
||||
warn(`Already shutting down, ${reason} will not be reported.`)
|
||||
return
|
||||
}
|
||||
return api.shutdown(reason)
|
||||
}
|
||||
instanceApis[id] = api
|
||||
|
||||
const healthyGuard = () => {
|
||||
if (api.status() !== InstanceApiStatus.ShuttingDown) return
|
||||
throw new Error(`Instance is shutting down. Aborting.`)
|
||||
throw new Error(
|
||||
`HealthyGuard detected instance is shutting down. Aborting further initialization.`
|
||||
)
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user