fix: do not run cleanup and build parallel

fix: UI error toasts
This commit is contained in:
Andras Bacsai
2022-07-08 14:11:18 +02:00
parent d344a9bb4f
commit da11bae67c
18 changed files with 66 additions and 42 deletions

View File

@@ -106,23 +106,30 @@ fastify.listen({ port, host }, async (err: any, address: any) => {
await scheduler.start('cleanupStorage');
await scheduler.start('checkProxies')
// Check if no build is running, try to autoupdate.
// Check if no build is running
// Check for update
setInterval(async () => {
const { isAutoUpdateEnabled } = await prisma.setting.findFirst();
if (isAutoUpdateEnabled) {
if (scheduler.workers.has('deployApplication')) {
scheduler.workers.get('deployApplication').postMessage("status");
scheduler.workers.get('deployApplication').postMessage("status:autoUpdater");
}
}
}, 30000 * 10)
}, 60000 * 15)
// Cleanup storage
setInterval(async () => {
if (scheduler.workers.has('deployApplication')) {
scheduler.workers.get('deployApplication').postMessage("status:cleanupStorage");
}
}, 60000 * 10)
scheduler.on('worker deleted', async (name) => {
if (name === 'autoUpdater') {
await scheduler.start('deployApplication');
if (name === 'autoUpdater' || name === 'cleanupStorage') {
if (!scheduler.workers.has('deployApplication')) await scheduler.start('deployApplication');
}
});
});
async function initServer() {