modified: backend/src/services/ScriptExecutor.ts

This commit is contained in:
GEgorov
2025-12-15 16:15:59 +03:00
parent 0cca6f5d8e
commit bd755cd19f

View File

@@ -108,9 +108,9 @@ export class ScriptExecutor {
const AsyncFunction = Object.getPrototypeOf(async function(){}).constructor; const AsyncFunction = Object.getPrototypeOf(async function(){}).constructor;
const userFunction = new AsyncFunction('params', 'execQuery', code); const userFunction = new AsyncFunction('params', 'execQuery', code);
// Устанавливаем таймаут // Устанавливаем таймаут (10 минут)
const timeoutPromise = new Promise((_, reject) => { const timeoutPromise = new Promise((_, reject) => {
setTimeout(() => reject(new Error('Script execution timeout (30s)')), 30000); setTimeout(() => reject(new Error('Script execution timeout (10min)')), 600000);
}); });
// Выполняем скрипт с таймаутом // Выполняем скрипт с таймаутом
@@ -322,11 +322,11 @@ print(json.dumps(result))
} }
}); });
// Таймаут 30 секунд // Таймаут 10 минут
setTimeout(() => { setTimeout(() => {
python.kill(); python.kill();
reject(new Error('Python script execution timeout (30s)')); reject(new Error('Python script execution timeout (10min)'));
}, 30000); }, 600000);
}); });
} }