diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index 85f283aae..a2a391d80 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -1,7 +1,7 @@ { "name": "@hydrooj/hydrojudge", "bin": "bin/hydrojudge.js", - "version": "2.3.15", + "version": "2.3.16", "main": "package.json", "author": "undefined ", "repository": "https://github.com/hydro-dev/Hydro.git", @@ -32,4 +32,4 @@ "build": "tsc", "lint": "eslint . --ext ts --fix" } -} +} \ No newline at end of file diff --git a/packages/hydrojudge/src/hosts/hydro.ts b/packages/hydrojudge/src/hosts/hydro.ts index 79bda7f17..fb2c9a3b3 100644 --- a/packages/hydrojudge/src/hosts/hydro.ts +++ b/packages/hydrojudge/src/hosts/hydro.ts @@ -226,6 +226,7 @@ export default class Hydro { fs.writeFileSync(path.join(filePath, 'etags'), JSON.stringify(version)); await this.processData(filePath).catch(noop); } + fs.writeFileSync(path.join(filePath, 'lastUsage'), new Date().getTime().toString()); return filePath; } diff --git a/packages/hydrojudge/src/hosts/vj4.ts b/packages/hydrojudge/src/hosts/vj4.ts index b61477325..abf2da961 100644 --- a/packages/hydrojudge/src/hosts/vj4.ts +++ b/packages/hydrojudge/src/hosts/vj4.ts @@ -387,12 +387,16 @@ export default class VJ4 { try { ver = fs.readFileSync(path.join(filePath, 'version')).toString(); } 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.ensureDirSync(domainDir); await this.problemData(domainId, pid, filePath, 3, next); fs.writeFileSync(path.join(filePath, 'version'), version); + fs.writeFileSync(path.join(filePath, 'lastUsage'), new Date().getTime().toString()); return filePath; } diff --git a/packages/hydrojudge/src/service.ts b/packages/hydrojudge/src/service.ts index 08d79452b..94c5f0818 100644 --- a/packages/hydrojudge/src/service.ts +++ b/packages/hydrojudge/src/service.ts @@ -86,6 +86,7 @@ async function postInit() { } } fs.writeFileSync(path.join(filePath, 'etags'), JSON.stringify(version)); + fs.writeFileSync(path.join(filePath, 'lastUsage'), new Date().getTime().toString()); await processData(filePath).catch(noop); return filePath; }