Updates
This commit is contained in:
Vendored
+9
-3
@@ -79,13 +79,18 @@ function watchFolders(_a) {
|
||||
sync({ dirPath, dirs, options });
|
||||
yield (0, delay_1.default)();
|
||||
fs_1.default.watch(dirPath, { recursive: true }, (evt, fileName) => {
|
||||
if (global.SYNCING)
|
||||
console.log("Folder Changed", evt, fileName);
|
||||
if (fs_1.default.existsSync(global.SYNCING_FILE)) {
|
||||
console.log("Existing Sync found. Returning ...");
|
||||
return;
|
||||
}
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => {
|
||||
global.SYNCING = true;
|
||||
console.log("Folder Syncing in progress ...");
|
||||
console.log(`Writing Sync File =>${global.SYNCING_FILE}`);
|
||||
fs_1.default.writeFileSync(global.SYNCING_FILE, `SYNCING Folder: evt:${evt} :: fileName:${fileName}`);
|
||||
sync({ dirPath, dirs, options });
|
||||
process.exit(1);
|
||||
process.exit(global.SYNC_SUCCESS_EXIT_CODE);
|
||||
}, INTERVAL);
|
||||
});
|
||||
}
|
||||
@@ -159,4 +164,5 @@ function sync({ options, dirs, dirPath, init }) {
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log("Folder Sync Complete. Exiting ...");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user