Updates
This commit is contained in:
@@ -4,15 +4,16 @@ import { execSync } from "child_process";
|
||||
import delay from "../../utils/delay";
|
||||
import { SyncFoldersFnParams, SyncFoldersSyncFnParams } from "../../types";
|
||||
|
||||
let timeout: any;
|
||||
const UPDATE_TIMEOUT = 200;
|
||||
|
||||
export default async function watchFolders({
|
||||
folders,
|
||||
options,
|
||||
}: SyncFoldersFnParams) {
|
||||
let timeout: any;
|
||||
const UPDATE_TIMEOUT = 200;
|
||||
|
||||
try {
|
||||
const dirs = folders;
|
||||
const dirs = folders;
|
||||
|
||||
console.log(`Now handling ${dirs.length} Directories`);
|
||||
|
||||
@@ -86,6 +87,7 @@ export default async function watchFolders({
|
||||
|
||||
fs.watch(dirPath, { recursive: true }, (evt, fileName) => {
|
||||
if (global.SYNCING) return;
|
||||
|
||||
clearTimeout(timeout);
|
||||
|
||||
timeout = setTimeout(() => {
|
||||
@@ -117,8 +119,8 @@ function sync({ options, dirs, dirPath, init }: SyncFoldersSyncFnParams) {
|
||||
}
|
||||
|
||||
if (options?.include?.[0]) {
|
||||
options.include.forEach((excl) => {
|
||||
cmdArray.push(`--include='${excl}'`);
|
||||
options.include.forEach((incl) => {
|
||||
cmdArray.push(`--include='${incl}'`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user