modified: backend/src/services/ScriptExecutor.ts
This commit is contained in:
@@ -108,9 +108,9 @@ export class ScriptExecutor {
|
||||
const AsyncFunction = Object.getPrototypeOf(async function(){}).constructor;
|
||||
const userFunction = new AsyncFunction('params', 'execQuery', code);
|
||||
|
||||
// Устанавливаем таймаут
|
||||
// Устанавливаем таймаут (10 минут)
|
||||
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(() => {
|
||||
python.kill();
|
||||
reject(new Error('Python script execution timeout (30s)'));
|
||||
}, 30000);
|
||||
reject(new Error('Python script execution timeout (10min)'));
|
||||
}, 600000);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user