mirror of
https://github.com/pockethost/pockethost.git
synced 2025-06-06 06:06:45 +00:00
chore: kill span process for central db when shutting down
This commit is contained in:
parent
6d63078fcf
commit
22cb70d444
@ -6,7 +6,12 @@ import {
|
|||||||
smartFetch,
|
smartFetch,
|
||||||
tryFetch,
|
tryFetch,
|
||||||
} from '$util'
|
} from '$util'
|
||||||
import { createTimerManager, logger, safeCatch } from '@pockethost/common'
|
import {
|
||||||
|
createCleanupManager,
|
||||||
|
createTimerManager,
|
||||||
|
logger,
|
||||||
|
safeCatch,
|
||||||
|
} from '@pockethost/common'
|
||||||
import { mkSingleton } from '@pockethost/common/src/mkSingleton'
|
import { mkSingleton } from '@pockethost/common/src/mkSingleton'
|
||||||
import { keys } from '@s-libs/micro-dash'
|
import { keys } from '@s-libs/micro-dash'
|
||||||
import { spawn } from 'child_process'
|
import { spawn } from 'child_process'
|
||||||
@ -58,6 +63,7 @@ export const createPocketbaseService = async (
|
|||||||
|
|
||||||
const { cachePath, checkIntervalMs } = config
|
const { cachePath, checkIntervalMs } = config
|
||||||
|
|
||||||
|
const cm = createCleanupManager()
|
||||||
const tm = createTimerManager({})
|
const tm = createTimerManager({})
|
||||||
|
|
||||||
const osName = type().toLowerCase()
|
const osName = type().toLowerCase()
|
||||||
@ -158,6 +164,7 @@ export const createPocketbaseService = async (
|
|||||||
}
|
}
|
||||||
dbg(`Spawning ${slug}`, { bin, args })
|
dbg(`Spawning ${slug}`, { bin, args })
|
||||||
const ls = spawn(bin, args)
|
const ls = spawn(bin, args)
|
||||||
|
cm.add(() => ls.kill())
|
||||||
|
|
||||||
ls.stdout.on('data', (data) => {
|
ls.stdout.on('data', (data) => {
|
||||||
dbg(`${slug} stdout: ${data}`)
|
dbg(`${slug} stdout: ${data}`)
|
||||||
@ -199,6 +206,7 @@ export const createPocketbaseService = async (
|
|||||||
const shutdown = () => {
|
const shutdown = () => {
|
||||||
dbg(`Shutting down pocketbaseService`)
|
dbg(`Shutting down pocketbaseService`)
|
||||||
tm.shutdown()
|
tm.shutdown()
|
||||||
|
cm.shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user