This commit is contained in:
Benjamin Toby
2025-02-04 13:42:30 +01:00
parent 8a1294a348
commit efcee1bb11
24 changed files with 100 additions and 23 deletions
+3 -1
View File
@@ -5,7 +5,7 @@ import delay from "../../utils/delay";
import { SyncFoldersFnParams, SyncFoldersSyncFnParams } from "../../types";
let timeout: any;
const UPDATE_TIMEOUT = 2000;
const UPDATE_TIMEOUT = 200;
export default async function watchFolders({
folders,
@@ -85,9 +85,11 @@ export default async function watchFolders({
await delay();
fs.watch(dirPath, { recursive: true }, (evt, fileName) => {
if (global.SYNCING) return;
clearTimeout(timeout);
timeout = setTimeout(() => {
global.SYNCING = true;
sync({ dirPath, dirs, options });
process.exit(1);
}, INTERVAL);