From c4b09831a8ab349d61f5ac4577f8856600921db7 Mon Sep 17 00:00:00 2001 From: Alex Tugarev Date: Mon, 14 Feb 2022 07:56:56 +0000 Subject: [PATCH] [server/ide-config] update only, if file was modified ... but ignore frequent file accesses. --- components/server/src/ide-config.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/server/src/ide-config.ts b/components/server/src/ide-config.ts index 8c487f54dd1f9a..1e9549256cc782 100644 --- a/components/server/src/ide-config.ts +++ b/components/server/src/ide-config.ts @@ -103,7 +103,11 @@ export class IDEConfigService { this.configPath = filePathTelepresenceAware(configPath); this.validate = this.ajv.compile(scheme); this.reconcile("initial"); - fs.watchFile(this.configPath, () => this.reconcile("file changed")); + fs.watchFile(this.configPath, (curr, prev) => { + if (curr.mtimeMs != prev.mtimeMs) { + this.reconcile("file changed"); + } + }); repeat(() => this.reconcile("interval"), 60 * 60 * 1000 /* 1 hour */); }