17529: Heed MaxCloudOpsPerSecond in Instances() and returned insts.
authorTom Clegg <tom@curii.com>
Fri, 16 Apr 2021 13:59:01 +0000 (09:59 -0400)
committerTom Clegg <tom@curii.com>
Fri, 16 Apr 2021 13:59:01 +0000 (09:59 -0400)
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>

lib/dispatchcloud/driver.go

index 462c3683f92c474fb621e61604f17ff7d9ca553c..5fcc0903f5d1b43d3b58e83d8e6721832985c4ed 100644 (file)
@@ -55,6 +55,15 @@ type rateLimitedInstanceSet struct {
        ticker *time.Ticker
 }
 
+func (is rateLimitedInstanceSet) Instances(tags cloud.InstanceTags) ([]cloud.Instance, error) {
+       <-is.ticker.C
+       insts, err := is.InstanceSet.Instances(tags)
+       for i, inst := range insts {
+               insts[i] = &rateLimitedInstance{inst, is.ticker}
+       }
+       return insts, err
+}
+
 func (is rateLimitedInstanceSet) Create(it arvados.InstanceType, image cloud.ImageID, tags cloud.InstanceTags, init cloud.InitCommand, pk ssh.PublicKey) (cloud.Instance, error) {
        <-is.ticker.C
        inst, err := is.InstanceSet.Create(it, image, tags, init, pk)