initialize last mtime with actual fs value
This commit is contained in:
parent
10f430592d
commit
c90c0c6688
2 changed files with 3 additions and 7 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "mtproto_exporter",
|
"name": "mtproto_exporter",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "1.5.1",
|
"version": "1.5.2",
|
||||||
"packageManager": "pnpm@10.6.5",
|
"packageManager": "pnpm@10.6.5",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -62,18 +62,14 @@ if (config.keywords) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let lastMtimeMs = 0;
|
let lastMtimeMs = (await fs.promises.stat(config.keywordsFile)).mtimeMs;
|
||||||
|
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
const stat = await fs.promises.stat(config.keywordsFile);
|
const stat = await fs.promises.stat(config.keywordsFile);
|
||||||
if (lastMtimeMs === stat.mtimeMs) {
|
if (lastMtimeMs === stat.mtimeMs) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastMtimeMs === 0 && stat.mtimeMs !== 0) {
|
|
||||||
lastMtimeMs = stat.mtimeMs;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
lastMtimeMs = stat.mtimeMs;
|
lastMtimeMs = stat.mtimeMs;
|
||||||
|
|
||||||
console.log("[watch-file] Keywords file was updated. Reloading keywords configuration...");
|
console.log("[watch-file] Keywords file was updated. Reloading keywords configuration...");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue