7162: move replicasPerThread logic outside the for loop.
authorradhika <radhika@curoverse.com>
Thu, 24 Sep 2015 20:25:37 +0000 (16:25 -0400)
committerradhika <radhika@curoverse.com>
Thu, 24 Sep 2015 20:25:37 +0000 (16:25 -0400)
sdk/go/keepclient/support.go

index 0cedc5efb7a5c09c4c1becef5f51083f4c005ae6..df02d221be29f6b7b7c0e35a41766c0ceb41a07e 100644 (file)
@@ -236,13 +236,13 @@ func (this KeepClient) putReplicas(
        // Desired number of replicas
        remaining_replicas := this.Want_replicas
 
-       for remaining_replicas > 0 {
-               replicasPerThread := this.replicasPerService
-               if replicasPerThread < 1 {
-                       // unlimited or unknown
-                       replicasPerThread = remaining_replicas
-               }
+       replicasPerThread := this.replicasPerService
+       if replicasPerThread < 1 {
+               // unlimited or unknown
+               replicasPerThread = remaining_replicas
+       }
 
+       for remaining_replicas > 0 {
                for active*replicasPerThread < remaining_replicas {
                        // Start some upload requests
                        if next_server < len(sv) {