Files
aigen/server/api/comfy/force-reset.post.ts
T

19 lines
694 B
TypeScript

import { withSharedGpuReset } from '~/server/utils/sharedGpu'
import { libraryOwnerKey } from '~/server/utils/library'
import { requestComfyForceReset } from '~/server/utils/comfyLifecycle'
import { clearStuckStudioWork } from '~/server/utils/studioQueue'
export default defineEventHandler(async (event) => {
const owner = libraryOwnerKey(event)
return withSharedGpuReset(async () => {
const cleared = await clearStuckStudioWork(owner)
const comfy = await requestComfyForceReset()
return {
ok: true,
message: 'Cleared every stuck Studio/music/shot job and force-stopped Comfy. Use Wake / Poke when you want the GPU again.',
cleared,
comfy
}
})
})