(
private db: PrismaClient,
private connectionManager: ConnectionManager,
configPath: string,
)
| 14 | private watcher: FSWatcher; |
| 15 | |
| 16 | constructor( |
| 17 | private db: PrismaClient, |
| 18 | private connectionManager: ConnectionManager, |
| 19 | configPath: string, |
| 20 | ) { |
| 21 | this.watcher = chokidar.watch(configPath, { |
| 22 | ignoreInitial: true, // Don't fire events for existing files |
| 23 | awaitWriteFinish: { |
| 24 | stabilityThreshold: 100, // File size stable for 100ms |
| 25 | pollInterval: 100 // Check every 100ms |
| 26 | }, |
| 27 | atomic: true // Handle atomic writes (temp file + rename) |
| 28 | }); |
| 29 | |
| 30 | this.watcher.on('change', async () => { |
| 31 | logger.debug(`Config file ${configPath} changed. Syncing config.`); |
| 32 | try { |
| 33 | await this.syncConfig(configPath); |
| 34 | } catch (error) { |
| 35 | logger.error(`Failed to sync config: ${error}`); |
| 36 | } |
| 37 | }); |
| 38 | |
| 39 | this.syncConfig(configPath); |
| 40 | } |
| 41 | |
| 42 | private syncConfig = async (configPath: string) => { |
| 43 | const config = await loadConfig(configPath); |
nothing calls this directly
no outgoing calls
no test coverage detected