42
43
constructor(
45
>
@IFileService private readonly fileService: IFileService,
46
>
@ILogService private readonly logService: ILogService,
47
>
) {
48
>
super();
49
>
50
>
const onDidChangeFile = Event.filter(fileService.onDidFilesChange, e => e.affects(file));
51
>
this._register(fileService.watch(file));
52
>
this._register(onDidChangeFile(() => this.throttledDelayer.trigger(() => this.refresh())));
53
>
54
>
// Initial read — routed through the same delayer (with no delay) so it is serialized
55
>
// against change-triggered refreshes and can't be clobbered by a racing read. Non-blocking;
56
>
// IPC clients handle eventual data arrival.
57
>
this.throttledDelayer.trigger(() => this.refresh(), 0);
58
>
}
59
60
private async refresh(): Promise<void> {
62
>
const previous = this._managedSettings;
63
>
64
>
try {
65
>
const content = await this.fileService.readFile(this.file, { limits: { size: MANAGED_SETTINGS_MAX_FILE_SIZE } });
66
const parsed = JSON.parse(content.value.toString());
67