judge: 记录测试数据的最后使用时间

This commit is contained in:
undefined committed 2021-02-28 14:19:20 +08:00
1 parent 323e7011ba
commit c251cf33e8
4 files changed
+9 -3

No files matched your search

+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"name": "@hydrooj/hydrojudge", "name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js", "bin": "bin/hydrojudge.js",
"version": "2.3.15", "version": "2.3.16",
"main": "package.json", "main": "package.json",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"repository": "https://github.com/hydro-dev/Hydro.git", "repository": "https://github.com/hydro-dev/Hydro.git",
@@ -32,4 +32,4 @@
"build": "tsc", "build": "tsc",
"lint": "eslint . --ext ts --fix" "lint": "eslint . --ext ts --fix"
} }
} }
+1
View File
@@ -226,6 +226,7 @@ export default class Hydro {
fs.writeFileSync(path.join(filePath, 'etags'), JSON.stringify(version)); fs.writeFileSync(path.join(filePath, 'etags'), JSON.stringify(version));
await this.processData(filePath).catch(noop); await this.processData(filePath).catch(noop);
} }
fs.writeFileSync(path.join(filePath, 'lastUsage'), new Date().getTime().toString());
return filePath; return filePath;
} }
+5 -1
View File
@@ -387,12 +387,16 @@ export default class VJ4 {
try { try {
ver = fs.readFileSync(path.join(filePath, 'version')).toString(); ver = fs.readFileSync(path.join(filePath, 'version')).toString();
} catch (e) { /* ignore */ } } catch (e) { /* ignore */ }
if (version === ver) return filePath; if (version === ver) {
fs.writeFileSync(path.join(filePath, 'lastUsage'), new Date().getTime().toString());
return filePath;
}
fs.removeSync(filePath); fs.removeSync(filePath);
} }
fs.ensureDirSync(domainDir); fs.ensureDirSync(domainDir);
await this.problemData(domainId, pid, filePath, 3, next); await this.problemData(domainId, pid, filePath, 3, next);
fs.writeFileSync(path.join(filePath, 'version'), version); fs.writeFileSync(path.join(filePath, 'version'), version);
fs.writeFileSync(path.join(filePath, 'lastUsage'), new Date().getTime().toString());
return filePath; return filePath;
} }
+1
View File
@@ -86,6 +86,7 @@ async function postInit() {
} }
} }
fs.writeFileSync(path.join(filePath, 'etags'), JSON.stringify(version)); fs.writeFileSync(path.join(filePath, 'etags'), JSON.stringify(version));
fs.writeFileSync(path.join(filePath, 'lastUsage'), new Date().getTime().toString());
await processData(filePath).catch(noop); await processData(filePath).catch(noop);
return filePath; return filePath;
} }