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(); });