fix: build
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { Format, LogLevel, setGlobalFormat, setGlobalLogLevel } from '@guiiai/logg'
|
||||
import { Client } from '@proj-airi/server-sdk'
|
||||
|
||||
import { runUntilSignal } from './utils/process'
|
||||
import { runUntilSignal } from '@proj-airi/server-sdk/utils/node'
|
||||
|
||||
setGlobalFormat(Format.Pretty)
|
||||
setGlobalLogLevel(LogLevel.Log)
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import process from 'node:process'
|
||||
import { useLogg } from '@guiiai/logg'
|
||||
|
||||
const logger = useLogg('process').useGlobalConfig()
|
||||
|
||||
let running = true
|
||||
|
||||
function killProcess() {
|
||||
running = false
|
||||
}
|
||||
|
||||
process.on('SIGTERM', () => {
|
||||
logger.log('SIGTERM received')
|
||||
killProcess()
|
||||
})
|
||||
process.on('SIGINT', () => {
|
||||
logger.log('SIGINT received')
|
||||
killProcess()
|
||||
})
|
||||
process.on('uncaughtException', (e) => {
|
||||
logger.withError(e).error('uncaught exception')
|
||||
killProcess()
|
||||
})
|
||||
|
||||
export function runUntilSignal() {
|
||||
setTimeout(() => {
|
||||
if (running)
|
||||
runUntilSignal()
|
||||
}, 10)
|
||||
}
|
||||
Reference in New Issue
Block a user