fix(tui): preserve worker rejection handling (#33448)
Co-authored-by: Dax Raad <d@ironbay.co>
This commit is contained in:
@@ -13,6 +13,13 @@ import { disposeAllInstancesAndEmitGlobalDisposed } from "@/server/global-lifecy
|
|||||||
|
|
||||||
Heap.start()
|
Heap.start()
|
||||||
|
|
||||||
|
const onUnhandledRejection = (_error: unknown) => {}
|
||||||
|
|
||||||
|
const onUncaughtException = (_error: Error) => {}
|
||||||
|
|
||||||
|
process.on("unhandledRejection", onUnhandledRejection)
|
||||||
|
process.on("uncaughtException", onUncaughtException)
|
||||||
|
|
||||||
// Subscribe to global events and forward them via RPC
|
// Subscribe to global events and forward them via RPC
|
||||||
GlobalBus.on("event", (event) => {
|
GlobalBus.on("event", (event) => {
|
||||||
Rpc.emit("global.event", event)
|
Rpc.emit("global.event", event)
|
||||||
@@ -65,6 +72,8 @@ export const rpc = {
|
|||||||
async shutdown() {
|
async shutdown() {
|
||||||
await InstanceRuntime.disposeAllInstances()
|
await InstanceRuntime.disposeAllInstances()
|
||||||
if (server) await server.stop(true)
|
if (server) await server.stop(true)
|
||||||
|
process.off("unhandledRejection", onUnhandledRejection)
|
||||||
|
process.off("uncaughtException", onUncaughtException)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user