mirror of
https://github.com/pockethost/pockethost.git
synced 2025-07-01 10:22:31 +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()
|
return shutdownManager.shutdown()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
const _safeShutdown = async (reason?: Error) =>
|
const _safeShutdown = async (reason?: Error) => {
|
||||||
api.status() === InstanceApiStatus.ShuttingDown || api.shutdown(reason)
|
if (api.status() === InstanceApiStatus.ShuttingDown) {
|
||||||
|
warn(`Already shutting down, ${reason} will not be reported.`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return api.shutdown(reason)
|
||||||
|
}
|
||||||
instanceApis[id] = api
|
instanceApis[id] = api
|
||||||
|
|
||||||
const healthyGuard = () => {
|
const healthyGuard = () => {
|
||||||
if (api.status() !== InstanceApiStatus.ShuttingDown) return
|
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