fix: cleanup prisma engine if there is more than 1

This commit is contained in:
Andras Bacsai 2022-08-12 10:36:51 +02:00
parent ddd09412cd
commit 5d5a478cd1
2 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,10 @@ import { asyncExecShell, isDev, prisma } from '../lib/common';
if (parentPort) { if (parentPort) {
if (!isDev) { if (!isDev) {
try { try {
await asyncExecShell(`killall -q -e /app/prisma-engines/query-engine -o 10m`) const { stdout } = await asyncExecShell(`ps -ef | grep /app/prisma-engines/query-engine | grep -v grep | wc -l | xargs`)
if (stdout.trim() != null && stdout.trim() != '' && Number(stdout.trim()) > 1) {
await asyncExecShell(`killall -q -e /app/prisma-engines/query-engine -o 10m`)
}
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} finally { } finally {

View File

@ -37,6 +37,7 @@ const options: any = {
}, },
{ {
name: 'cleanupPrismaEngines', name: 'cleanupPrismaEngines',
interval: '1m'
}, },
{ {
name: 'checkProxies', name: 'checkProxies',