aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/services/impl/ConfigPersistenceServiceImpl.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-01-08 21:36:43 +0100
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-01-09 19:53:03 +0100
commitd07e7b834831230b53860d0919a68edc2d36193d (patch)
treea1f2a021563ddff54f33341c475fc6c6eb787388 /packages/main/src/services/impl/ConfigPersistenceServiceImpl.ts
parentNew configurations based on review comments (WIP) (diff)
downloadsophie-d07e7b834831230b53860d0919a68edc2d36193d.tar.gz
sophie-d07e7b834831230b53860d0919a68edc2d36193d.tar.zst
sophie-d07e7b834831230b53860d0919a68edc2d36193d.zip
build: Eslint fixes for multi-module project
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/main/src/services/impl/ConfigPersistenceServiceImpl.ts')
-rw-r--r--packages/main/src/services/impl/ConfigPersistenceServiceImpl.ts20
1 files changed, 11 insertions, 9 deletions
diff --git a/packages/main/src/services/impl/ConfigPersistenceServiceImpl.ts b/packages/main/src/services/impl/ConfigPersistenceServiceImpl.ts
index 2d19632..df8c807 100644
--- a/packages/main/src/services/impl/ConfigPersistenceServiceImpl.ts
+++ b/packages/main/src/services/impl/ConfigPersistenceServiceImpl.ts
@@ -19,18 +19,20 @@
19 */ 19 */
20import { watch } from 'fs'; 20import { watch } from 'fs';
21import { readFile, stat, writeFile } from 'fs/promises'; 21import { readFile, stat, writeFile } from 'fs/promises';
22import JSON5 from 'json5';
23import { throttle } from 'lodash-es';
24import { join } from 'path'; 22import { join } from 'path';
25 23
26import type { ConfigPersistenceService, ReadConfigResult } from '../ConfigPersistenceService.js'; 24import JSON5 from 'json5';
27import type { ConfigSnapshotOut } from '../../stores/Config.js'; 25import throttle from 'lodash-es/throttle';
28import { Disposer } from '../../utils/disposer'; 26
29import { getLogger } from '../../utils/logging'; 27import type { ConfigSnapshotOut } from '../../stores/Config';
28import type Disposer from '../../utils/Disposer';
29import { getLogger } from '../../utils/log';
30import type ConfigPersistenceService from '../ConfigPersistenceService';
31import type { ReadConfigResult } from '../ConfigPersistenceService';
30 32
31const log = getLogger('configPersistence'); 33const log = getLogger('configPersistence');
32 34
33export class ConfigPersistenceServiceImpl implements ConfigPersistenceService { 35export default class ConfigPersistenceServiceImpl implements ConfigPersistenceService {
34 private readonly configFilePath: string; 36 private readonly configFilePath: string;
35 37
36 private writingConfig = false; 38 private writingConfig = false;
@@ -103,7 +105,7 @@ export class ConfigPersistenceServiceImpl implements ConfigPersistenceService {
103 'whish is newer than last written', 105 'whish is newer than last written',
104 this.timeLastWritten, 106 this.timeLastWritten,
105 ); 107 );
106 return callback(); 108 await callback();
107 } 109 }
108 }, throttleMs); 110 }, throttleMs);
109 111
@@ -115,7 +117,7 @@ export class ConfigPersistenceServiceImpl implements ConfigPersistenceService {
115 if (eventType === 'change' 117 if (eventType === 'change'
116 && (filename === this.configFileName || filename === null)) { 118 && (filename === this.configFileName || filename === null)) {
117 configChanged()?.catch((err) => { 119 configChanged()?.catch((err) => {
118 console.log('Unhandled error while listening for config changes', err); 120 log.error('Unhandled error while listening for config changes', err);
119 }); 121 });
120 } 122 }
121 }); 123 });