feat: Add the stop/start loop for the service

This commit is contained in:
J H
2024-03-06 10:55:21 -07:00
parent 093a5d4ddf
commit 8410929e86
5 changed files with 52 additions and 13 deletions

View File

@@ -86,10 +86,11 @@ export class MainLoop {
public async clean(options?: { timeout?: number }) {
const { mainEvent, healthLoops, propertiesEvent } = this
const main = await mainEvent
delete this.mainEvent
delete this.healthLoops
delete this.propertiesEvent
if (mainEvent) await (await mainEvent).daemon.term()
if (mainEvent) await main?.daemon.term()
clearInterval(propertiesEvent)
if (healthLoops) healthLoops.forEach((x) => clearInterval(x.interval))
}