From 0799d1e11b32e880d52a3a3a99f97474218f4144 Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Mon, 15 Jan 2024 08:47:51 -0800 Subject: [PATCH] fix: instance logger tails cleaned up on exit --- src/services/InstanceLoggerService/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/InstanceLoggerService/index.ts b/src/services/InstanceLoggerService/index.ts index bd34ee41..1e3886ca 100644 --- a/src/services/InstanceLoggerService/index.ts +++ b/src/services/InstanceLoggerService/index.ts @@ -1,5 +1,6 @@ import { DEBUG, mkInstanceDataPath } from '$constants' import { LoggerService, createCleanupManager } from '$shared' +import { asyncExitHook } from '$util' import * as fs from 'fs' import { Tail } from 'tail' import * as winston from 'winston' @@ -103,8 +104,11 @@ export function InstanceLogger(instanceId: string, target: string) { } check() + const unsub = asyncExitHook(() => cm.shutdown()) + return () => { cm.shutdown() + unsub() } }, }