Skip to content

Commit

Permalink
[server/ide-config] update only, if file was modified
Browse files Browse the repository at this point in the history
... but ignore frequent file accesses.
  • Loading branch information
AlexTugarev authored and roboquat committed Feb 14, 2022
1 parent 43c2767 commit c4b0983
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/server/src/ide-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */);
}

Expand Down

0 comments on commit c4b0983

Please sign in to comment.