mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
eslint: variable naming
This commit is contained in:
1 parent
55a95b97ea
commit
268ac23b26
17 files changed
+96
-52
No files matched your search
@@ -189,8 +189,8 @@ function isValidConfig(config) {
|
||||
if (config.count > (getConfig('testcases_max') || 100)) {
|
||||
throw new FormatError('Too many testcases. Cancelled.');
|
||||
}
|
||||
const total_time = sum(config.subtasks.map((subtask) => subtask.time * subtask.cases.length));
|
||||
if (total_time > (getConfig('total_time_limit') || 60) * 1000) {
|
||||
const time = sum(config.subtasks.map((subtask) => subtask.time * subtask.cases.length));
|
||||
if (time > (getConfig('total_time_limit') || 60) * 1000) {
|
||||
throw new FormatError('Total time limit longer than {0}s. Cancelled.', [+getConfig('total_time_limit') || 60]);
|
||||
}
|
||||
const memMax = max(config.subtasks.map((subtask) => subtask.memory));
|
||||
|
||||
@@ -6,6 +6,7 @@ import fs from 'fs-extra';
|
||||
import yaml from 'js-yaml';
|
||||
|
||||
const argv = cac().parse();
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
let CONFIG_FILE = path.resolve(os.homedir(), '.config', 'hydro', 'judge.yaml');
|
||||
|
||||
let config = {
|
||||
|
||||
@@ -30,7 +30,7 @@ declare global {
|
||||
}
|
||||
if (!global.onDestory) global.onDestory = [];
|
||||
if (!global.hosts) global.hosts = [];
|
||||
let SI = false;
|
||||
let exit = false;
|
||||
|
||||
const terminate = async () => {
|
||||
log.info('正在保存数据');
|
||||
@@ -38,11 +38,11 @@ const terminate = async () => {
|
||||
await Promise.all(global.onDestory.map((f) => f()));
|
||||
process.exit(1);
|
||||
} catch (e) {
|
||||
if (SI) process.exit(1);
|
||||
if (exit) process.exit(1);
|
||||
log.error(e.stack);
|
||||
log.error('发生了错误。');
|
||||
log.error('再次按下 Ctrl-C 可强制退出。');
|
||||
SI = true;
|
||||
exit = true;
|
||||
}
|
||||
};
|
||||
process.on('SIGINT', terminate);
|
||||
@@ -60,7 +60,7 @@ async function worker(queue: Queue<any>) {
|
||||
|
||||
async function daemon() {
|
||||
const _hosts = getConfig('hosts');
|
||||
const retry_delay_sec = getConfig('retry_delay_sec');
|
||||
const delay = getConfig('retry_delay_sec');
|
||||
const hosts = {};
|
||||
const queue = new Queue<any>();
|
||||
for (const i in _hosts) {
|
||||
@@ -77,8 +77,8 @@ async function daemon() {
|
||||
break;
|
||||
} catch (e) {
|
||||
log.error(e, e.stack);
|
||||
log.info(`在 ${retry_delay_sec} 秒后重试`);
|
||||
await sleep(retry_delay_sec * 1000);
|
||||
log.info(`在 ${delay} 秒后重试`);
|
||||
await sleep(delay * 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ function proc({
|
||||
execute = '',
|
||||
time = 16000,
|
||||
memory = parseMemoryMB(getConfig('memoryMax')),
|
||||
process_limit = getConfig('processLimit'),
|
||||
processLimit = getConfig('processLimit'),
|
||||
stdin = '', copyIn = {}, copyOut = [], copyOutCached = [],
|
||||
} = {}) {
|
||||
if (!supportOptional) {
|
||||
@@ -48,7 +48,7 @@ function proc({
|
||||
memoryLimit: Math.floor(memory * 1024 * 1024),
|
||||
strictMemoryLimit: getConfig('strict_memory'),
|
||||
// stackLimit: memory * 1024 * 1024,
|
||||
procLimit: process_limit,
|
||||
procLimit: processLimit,
|
||||
copyIn,
|
||||
copyOut,
|
||||
copyOutCached,
|
||||
|
||||
Reference in new issue
Block a user