From c90c0c6688675f302a2a045ea32299aede18a83c Mon Sep 17 00:00:00 2001 From: soffee Date: Tue, 27 Jan 2026 02:09:37 +0300 Subject: [PATCH] initialize last mtime with actual fs value --- package.json | 2 +- src/main.ts | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 68c5d49..a1a34a8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mtproto_exporter", "type": "module", - "version": "1.5.1", + "version": "1.5.2", "packageManager": "pnpm@10.6.5", "license": "MIT", "scripts": { diff --git a/src/main.ts b/src/main.ts index e984f68..f494e41 100644 --- a/src/main.ts +++ b/src/main.ts @@ -62,18 +62,14 @@ if (config.keywords) { } }; - let lastMtimeMs = 0; + let lastMtimeMs = (await fs.promises.stat(config.keywordsFile)).mtimeMs; + setInterval(async () => { const stat = await fs.promises.stat(config.keywordsFile); if (lastMtimeMs === stat.mtimeMs) { return; } - if (lastMtimeMs === 0 && stat.mtimeMs !== 0) { - lastMtimeMs = stat.mtimeMs; - return; - } - lastMtimeMs = stat.mtimeMs; console.log("[watch-file] Keywords file was updated. Reloading keywords configuration...");