1
0
mirror of https://github.com/gilbertchen/duplicacy synced 2025-12-11 05:43:23 +00:00

Use number of threads specified on copy command

This commit is contained in:
Jeff Thompson
2017-09-06 17:01:27 -05:00
parent 197d20f0e0
commit 612c5b7746

View File

@@ -1020,12 +1020,17 @@ func copySnapshots(context *cli.Context) {
os.Exit(ArgumentExitCode) os.Exit(ArgumentExitCode)
} }
threads := context.Int("threads")
if threads < 1 {
threads = 1
}
repository, source := getRepositoryPreference(context, context.String("from")) repository, source := getRepositoryPreference(context, context.String("from"))
runScript(context, source.Name, "pre") runScript(context, source.Name, "pre")
duplicacy.LOG_INFO("STORAGE_SET", "Source storage set to %s", source.StorageURL) duplicacy.LOG_INFO("STORAGE_SET", "Source storage set to %s", source.StorageURL)
sourceStorage := duplicacy.CreateStorage(*source, false, 1) sourceStorage := duplicacy.CreateStorage(*source, false, threads)
if sourceStorage == nil { if sourceStorage == nil {
return return
} }
@@ -1055,7 +1060,7 @@ func copySnapshots(context *cli.Context) {
duplicacy.LOG_INFO("STORAGE_SET", "Destination storage set to %s", destination.StorageURL) duplicacy.LOG_INFO("STORAGE_SET", "Destination storage set to %s", destination.StorageURL)
destinationStorage := duplicacy.CreateStorage(*destination, false, 1) destinationStorage := duplicacy.CreateStorage(*destination, false, threads)
if destinationStorage == nil { if destinationStorage == nil {
return return
} }
@@ -1080,11 +1085,6 @@ func copySnapshots(context *cli.Context) {
snapshotID = context.String("id") snapshotID = context.String("id")
} }
threads := context.Int("threads")
if threads < 1 {
threads = 1
}
sourceManager.CopySnapshots(destinationManager, snapshotID, revisions, threads) sourceManager.CopySnapshots(destinationManager, snapshotID, revisions, threads)
runScript(context, source.Name, "post") runScript(context, source.Name, "post")
} }