Updates
This commit is contained in:
Vendored
+3
-3
@@ -72,16 +72,16 @@ function watchFiles(_a) {
|
||||
fs_1.default.watchFile(filePath, {
|
||||
interval: interval || 200,
|
||||
}, (curr, prev) => {
|
||||
if (global.SYNCING)
|
||||
if (fs_1.default.existsSync(global.SYNCING_FILE))
|
||||
return;
|
||||
const INTERVAL = (options === null || options === void 0 ? void 0 : options.interval)
|
||||
? options.interval
|
||||
: UPDATE_TIMEOUT;
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => {
|
||||
global.SYNCING = true;
|
||||
fs_1.default.writeFileSync(global.SYNCING_FILE, `SYNCING FILE: curr:${curr} :: prev:${prev}`);
|
||||
sync({ options, filePath, files });
|
||||
process.exit(1);
|
||||
process.exit(global.SYNC_SUCCESS_EXIT_CODE);
|
||||
}, INTERVAL);
|
||||
});
|
||||
}
|
||||
|
||||
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