mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
fix: daemon lifecycle cleanup and error logging improvements
- Refactor HealthDaemon to use a tracked session (AbortController + awaitable promise) instead of fire-and-forget health check loops, preventing health checks from running after a service is stopped - Stop health checks before terminating daemon to avoid false crash reports during intentional shutdown - Guard onExit callbacks with AbortSignal to prevent stale session callbacks - Add logErrorOnce utility to deduplicate repeated error logging - Fix SystemForEmbassy.stop() to capture clean promise before deleting ref - Treat SIGTERM (signal 15) as successful exit in subcontainer sync - Fix asError to return original Error instead of wrapping in new Error - Remove unused ExtendedVersion import from Backups.ts
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
export const asError = (e: unknown) => {
|
||||
if (e instanceof Error) {
|
||||
return new Error(e as any)
|
||||
return e
|
||||
}
|
||||
if (typeof e === 'string') {
|
||||
return new Error(`${e}`)
|
||||
|
||||
@@ -32,3 +32,4 @@ export { deepEqual } from './deepEqual'
|
||||
export { AbortedError } from './AbortedError'
|
||||
export * as regexes from './regexes'
|
||||
export { stringFromStdErrOut } from './stringFromStdErrOut'
|
||||
export { logErrorOnce } from './logErrorOnce'
|
||||
|
||||
9
sdk/base/lib/util/logErrorOnce.ts
Normal file
9
sdk/base/lib/util/logErrorOnce.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
const loggedErrors = new WeakSet<object>()
|
||||
|
||||
export function logErrorOnce(err: unknown) {
|
||||
if (typeof err === 'object' && err !== null) {
|
||||
if (loggedErrors.has(err)) return
|
||||
loggedErrors.add(err)
|
||||
}
|
||||
console.error(err)
|
||||
}
|
||||
Reference in New Issue
Block a user