fix: ensure we wait for file to finish being written before emitting event

This commit is contained in:
Alexis Tyler
2021-05-03 15:52:25 +09:30
parent 03fe6c082e
commit 141f83d6cb

View File

@@ -52,7 +52,13 @@ export const keyFile = () => {
const watcher = chokidar.watch(keyDirectory, {
persistent: true,
ignoreInitial: true
ignoreInitial: true,
awaitWriteFinish: {
// Every 1/10 of a second poll
// If the size stays the same for 1s then emit the event
pollInterval: 100,
stabilityThreshold: 1000
}
});
coreLogger.debug('Loading watchers for %s', keyDirectory);