1
0
mirror of https://github.com/gilbertchen/duplicacy synced 2025-12-06 00:03:38 +00:00

Set file sizes to -1 before creating the file reader

This commit is contained in:
Gilbert Chen
2017-07-13 15:00:27 -04:00
parent 6a4b1f2a3f
commit 4a31fcfb68
3 changed files with 9 additions and 5 deletions

View File

@@ -11,8 +11,9 @@ ${DUPLICACY} init integration-tests $TEST_STORAGE -c 4
# Create 10 small files
add_file file1 20
add_file file2 20
add_file file3 20
rm file3; touch file3
add_file file4 20
chmod u-r file4
add_file file5 20
add_file file6 20
add_file file7 20

View File

@@ -10,6 +10,7 @@ backup
add_file file3
backup
add_file file4
chmod u-r ${TEST_REPO}/file4
backup
add_file file5
restore

View File

@@ -361,14 +361,16 @@ func (manager *BackupManager) Backup(top string, quickMode bool, threads int, ta
var uploadedChunkLengths []int
var uploadedChunkLock = &sync.Mutex{}
// the file reader implements the Reader interface. When an EOF is encounter, it opens the next file unless it
// is the last file.
fileReader := CreateFileReader(shadowTop, modifiedEntries)
// Set all file sizes to -1 to indicate they haven't been processed
// Set all file sizes to -1 to indicate they haven't been processed. This must be done before creating the file
// reader because the file reader may skip inaccessible files on construction.
for _, entry := range modifiedEntries {
entry.Size = -1
}
// the file reader implements the Reader interface. When an EOF is encounter, it opens the next file unless it
// is the last file.
fileReader := CreateFileReader(shadowTop, modifiedEntries)
startUploadingTime := time.Now().Unix()
lastUploadingTime := time.Now().Unix()