backuptask: track copy and upload statistics
This commit is contained in:
@@ -71,7 +71,7 @@ async function addFile(sourceFile, encryption, uploader, progressCallback) {
|
||||
await uploader.finish();
|
||||
|
||||
return {
|
||||
stats: ps.stats(), // { startTime, totalMsecs, transferred }
|
||||
stats: { transferred: ps.stats().transferred },
|
||||
integrity: { size: ps.stats().transferred, sha256: hash.digest('hex') }
|
||||
};
|
||||
}
|
||||
@@ -91,8 +91,6 @@ async function sync(backupSite, remotePath, dataLayout, progressCallback) {
|
||||
transferred: 0,
|
||||
size: [...integrityMap.values()].reduce((sum, integrity) => sum + (integrity?.size || 0), 0), // integrity can be null if file had disappeared during upload
|
||||
fileCount: addQueue.length + integrityMap.size, // final file count, not the transferred file count
|
||||
startTime: Date.now(),
|
||||
totalMsecs: 0
|
||||
};
|
||||
|
||||
const destPathIntegrityMap = new Map(); // unlike integrityMap which contains local filenames, this contains destination filenames (maybe encrypted)
|
||||
@@ -138,7 +136,7 @@ async function sync(backupSite, remotePath, dataLayout, progressCallback) {
|
||||
await syncer.finalize(integrityMap, cacheFile);
|
||||
|
||||
return {
|
||||
stats: { ...aggregatedStats, totalMsecs: Date.now()-aggregatedStats.startTime },
|
||||
stats: aggregatedStats,
|
||||
integrityMap: destPathIntegrityMap
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user