Do not call sftpSync if no entries need to be uploaded/downloaded

This commit is contained in:
2024-05-19 20:24:42 -04:00
parent bc9f8ed971
commit c5b7e76b88
+5 -3
View File
@@ -256,7 +256,7 @@ func sftpSync(downloadList, uploadList []string, manualSync bool) {
localFile.Close() localFile.Close()
remoteFile.Close() remoteFile.Close()
} }
fmt.Println("\nClient is synchronized with server.") fmt.Println("\nClient is synchronized with server")
} }
// syncLists determines which entries need to be downloaded and uploaded for synchronizations and calls sftpSync with this information // syncLists determines which entries need to be downloaded and uploaded for synchronizations and calls sftpSync with this information
@@ -292,8 +292,10 @@ func syncLists(localEntryModMap, remoteEntryModMap map[string]int64, manualSync
} }
// call sftpSync with the download and upload lists // call sftpSync with the download and upload lists
fmt.Println() // add a gap between list-add messages and the actual sync messages from sftpSync if max(len(downloadList), len(uploadList)) > 0 { // only call sftpSync if there are entries to download or upload
sftpSync(downloadList, uploadList, manualSync) fmt.Println() // add a gap between list-add messages and the actual sync messages from sftpSync
sftpSync(downloadList, uploadList, manualSync)
}
} }
// ShearRemoteFromClient removes the target file or directory from the local system and calls the server to remove it remotely and add it to the deletions list // ShearRemoteFromClient removes the target file or directory from the local system and calls the server to remove it remotely and add it to the deletions list