From dc52310e0ad93da805f232a67b155e81ad5048f1 Mon Sep 17 00:00:00 2001 From: MCHost Date: Wed, 23 Jul 2025 03:43:16 -0400 Subject: [PATCH] edit cronjob to 30 mins --- mymc-premium.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mymc-premium.js b/mymc-premium.js index 33fc990..32e86be 100644 --- a/mymc-premium.js +++ b/mymc-premium.js @@ -43,14 +43,14 @@ async function execWithTimeout(container, cmd, timeout = EXEC_TIMEOUT) { AttachStdout: true, AttachStderr: true }); - + const stream = await exec.start(); let output = ''; - + const timeoutPromise = new Promise((_, reject) => { setTimeout(() => reject(new Error(`Command ${cmd.join(' ')} timed out after ${timeout}ms`)), timeout); }); - + await Promise.race([ new Promise((resolve, reject) => { stream.on('data', (chunk) => output += chunk.toString()); @@ -59,7 +59,7 @@ async function execWithTimeout(container, cmd, timeout = EXEC_TIMEOUT) { }), timeoutPromise ]); - + return output; } catch (err) { throw err; @@ -83,7 +83,7 @@ async function updateContainerConfig(container, name, userId, memoryLimit) { try { await execWithTimeout(container, ['test', '-f', '/var/tools/pm2/startServer.json']); console.log(` ✅ startServer.json exists`); - + // Remove existing startServer.json console.log(` 🗑️ Removing existing startServer.json in container ${name}...`); await execWithTimeout(container, ['rm', '-f', '/var/tools/pm2/startServer.json']); @@ -257,7 +257,7 @@ client.once('ready', () => { checkContainers(); // Cron job every 5 minutes - const job = new CronJob('*/5 * * * *', checkContainers, null, true, 'UTC'); + const job = new CronJob('*/30 * * * *', checkContainers, null, true, 'UTC'); job.start(); });