mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-06 22:26:45 +00:00
enh: improve instance error logging
This commit is contained in:
parent
4d9ed9ded2
commit
f3d9ac8b68
@ -232,8 +232,7 @@ export const instanceService = mkSingleton(
|
|||||||
dbg(`Updated instance fields`, fields)
|
dbg(`Updated instance fields`, fields)
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
dbg(`Error updating instance fields`, fields)
|
error(`Error updating instance fields`, { fields, e })
|
||||||
error(e)
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -339,12 +338,16 @@ export const instanceService = mkSingleton(
|
|||||||
exitCode.then((code) => {
|
exitCode.then((code) => {
|
||||||
info(`Processes exited with ${code}.`)
|
info(`Processes exited with ${code}.`)
|
||||||
setImmediate(() => {
|
setImmediate(() => {
|
||||||
_safeShutdown().catch(error)
|
_safeShutdown().catch((err) => {
|
||||||
|
error(`Error shutting down ${id}`, { err })
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
shutdownManager.add(async () => {
|
shutdownManager.add(async () => {
|
||||||
dbg(`killing ${id}`)
|
dbg(`killing ${id}`)
|
||||||
await childProcess.kill().catch(error)
|
await childProcess.kill().catch((err) => {
|
||||||
|
error(`Error killing ${id}`, { err })
|
||||||
|
})
|
||||||
dbg(`killed ${id}`)
|
dbg(`killed ${id}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -379,7 +382,9 @@ export const instanceService = mkSingleton(
|
|||||||
userInstanceLogger.info(
|
userInstanceLogger.info(
|
||||||
`Instance has been idle for ${DAEMON_PB_IDLE_TTL()}ms. Hibernating to conserve resources.`,
|
`Instance has been idle for ${DAEMON_PB_IDLE_TTL()}ms. Hibernating to conserve resources.`,
|
||||||
)
|
)
|
||||||
await _safeShutdown().catch(error)
|
await _safeShutdown().catch((err) => {
|
||||||
|
error(`Error shutting down ${id}`, { err })
|
||||||
|
})
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
trace(`${openRequestCount} requests remain open`)
|
trace(`${openRequestCount} requests remain open`)
|
||||||
@ -407,7 +412,9 @@ export const instanceService = mkSingleton(
|
|||||||
return `${e}`
|
return `${e}`
|
||||||
})()
|
})()
|
||||||
warn(`Instance failed to start: ${detail}`)
|
warn(`Instance failed to start: ${detail}`)
|
||||||
_safeShutdown(e).catch(error)
|
_safeShutdown(e).catch((err) => {
|
||||||
|
error(`Error shutting down ${id}`, { err })
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
return api
|
return api
|
||||||
|
Loading…
x
Reference in New Issue
Block a user