fix: cleanup stucked prisma-engines

This commit is contained in:
Andras Bacsai
2022-08-12 09:38:11 +02:00
parent 0a44867240
commit e92d0914c2
5 changed files with 99 additions and 74 deletions

View File

@@ -0,0 +1,16 @@
import { parentPort } from 'node:worker_threads';
import { asyncExecShell, isDev, prisma } from '../lib/common';
(async () => {
if (parentPort) {
if (!isDev) {
try {
await asyncExecShell(`killall -q -e /app/prisma-engines/query-engine -o 10m`)
} catch (error) {
console.log(error);
} finally {
await prisma.$disconnect();
}
}
} else process.exit(0);
})();