From 0dc521206659cea85800d692a9df9f4a406f153e Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 25 Aug 2022 12:25:46 +0200 Subject: [PATCH] Revert things --- apps/api/src/index.ts | 19 +++++++------------ apps/api/src/jobs/deployApplication.ts | 7 +------ apps/api/src/jobs/test.ts | 15 --------------- 3 files changed, 8 insertions(+), 33 deletions(-) delete mode 100644 apps/api/src/jobs/test.ts diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts index 69efb7af0..3f4876c94 100644 --- a/apps/api/src/index.ts +++ b/apps/api/src/index.ts @@ -104,19 +104,14 @@ fastify.listen({ port, host }, async (err: any, address: any) => { } console.log(`Coolify's API is listening on ${host}:${port}`); await initServer(); - // await scheduler.start('cleanupPrismaEngines'); - // await scheduler.start('checkProxies'); + await scheduler.start('cleanupPrismaEngines'); + await scheduler.start('checkProxies'); - // setInterval(async () => { - // if (!scheduler.workers.has('test')) { - // scheduler.run('test'); - // } - // }, 2000) - // setInterval(async () => { - // if (!scheduler.workers.has('deployApplication')) { - // scheduler.run('deployApplication'); - // } - // }, 2000) + setInterval(async () => { + if (!scheduler.workers.has('deployApplication')) { + scheduler.run('deployApplication'); + } + }, 2000) // Check for update & if no build is running setInterval(async () => { diff --git a/apps/api/src/jobs/deployApplication.ts b/apps/api/src/jobs/deployApplication.ts index 261f8bd32..ca0154649 100644 --- a/apps/api/src/jobs/deployApplication.ts +++ b/apps/api/src/jobs/deployApplication.ts @@ -347,14 +347,9 @@ import * as buildpacks from '../lib/buildPacks'; } }); } - await pAll.default(actions, { concurrency }) } - - } catch (error) { - process.exit(0); - - } finally { + } catch (error) { } finally { await prisma.$disconnect(); process.exit(0); } diff --git a/apps/api/src/jobs/test.ts b/apps/api/src/jobs/test.ts deleted file mode 100644 index 2d0fc44c3..000000000 --- a/apps/api/src/jobs/test.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { parentPort } from 'node:worker_threads';; - -(async () => { - if (parentPort) { - parentPort.on('message', async (message) => { - if (message === 'error') throw new Error('oops'); - if (message === 'cancel') { - parentPort.postMessage('cancelled'); - process.exit(0); - } - }); - console.log('test job started'); - process.exit(0) - } else process.exit(0); -})();