From c251cf33e836c077c43cded417790036a0562725 Mon Sep 17 00:00:00 2001 From: undefined Date: Sun, 28 Feb 2021 14:19:20 +0800 Subject: [PATCH] =?UTF-8?q?judge:=20=E8=AE=B0=E5=BD=95=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E6=9C=80=E5=90=8E=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hydrojudge/package.json | 4 ++-- packages/hydrojudge/src/hosts/hydro.ts | 1 + packages/hydrojudge/src/hosts/vj4.ts | 6 +++++- packages/hydrojudge/src/service.ts | 1 + 4 files changed, 9 insertions(+), 3 deletions(-) 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; }