Add hack to figure out the position in the queue

this helps us track the progress a bit in the logs
This commit is contained in:
Girish Ramakrishnan
2018-03-20 18:25:04 -07:00
parent ce33681c37
commit 7699f6721d
3 changed files with 17 additions and 17 deletions
+3 -3
View File
@@ -104,14 +104,14 @@ function sync(dir, taskProcessor, concurrency, callback) {
if (entryStat.isDirectory()) {
traverse(entryPath);
} else {
addQueue.push({ operation: 'add', path: entryPath, reason: 'new' });
addQueue.push({ operation: 'add', path: entryPath, reason: 'new', position: addQueue.length });
}
} else if (ISDIR(cacheStat.mode) && entryStat.isDirectory()) { // dir names match
++curCacheIndex;
traverse(entryPath);
} else if (ISFILE(cacheStat.mode) && entryStat.isFile()) { // file names match
if (entryStat.mtime.getTime() !== cacheStat.mtime || entryStat.size != cacheStat.size || entryStat.inode !== cacheStat.inode) { // file changed
addQueue.push({ operation: 'add', path: entryPath, reason: 'changed' });
addQueue.push({ operation: 'add', path: entryPath, reason: 'changed', position: addQueue.length });
}
++curCacheIndex;
} else if (entryStat.isDirectory()) { // was a file, now a directory
@@ -121,7 +121,7 @@ function sync(dir, taskProcessor, concurrency, callback) {
} else { // was a dir, now a file
delQueue.push({ operation: 'removedir', path: cachePath, reason: 'wasdir' });
while (curCacheIndex !== cache.length && cache[curCacheIndex].path.startsWith(cachePath)) ++curCacheIndex;
addQueue.push({ operation: 'add', path: entryPath, reason: 'wasdir' });
addQueue.push({ operation: 'add', path: entryPath, reason: 'wasdir', position: addQueue.length });
}
}
}