[ARVADOS] updated: 1.3.0-167-g6756ee790

Git user git at public.curoverse.com
Mon Jan 14 14:14:00 EST 2019


Summary of changes:
 lib/cloud/azure.go                                  | 18 +++++++++---------
 lib/{dispatchcloud/worker => cloud}/gocheck_test.go |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)
 copy lib/{dispatchcloud/worker => cloud}/gocheck_test.go (93%)

       via  6756ee790a6c685b96bc1ec80b67e7d6c94e9846 (commit)
      from  f398e9d75d32fbfa6804041353997bf74195e489 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 6756ee790a6c685b96bc1ec80b67e7d6c94e9846
Author: Peter Amstutz <pamstutz at veritasgenetics.com>
Date:   Mon Jan 14 14:13:20 2019 -0500

    14324:  Fix API throttling header fallbacks.  Add gocheck_test
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/lib/cloud/azure.go b/lib/cloud/azure.go
index d94285d6a..a194b3318 100644
--- a/lib/cloud/azure.go
+++ b/lib/cloud/azure.go
@@ -166,15 +166,14 @@ func WrapAzureError(err error) error {
 		if parseErr != nil {
 			// Could not parse as a timestamp, must be number of seconds
 			dur, parseErr := strconv.ParseInt(ra, 10, 64)
-			if parseErr != nil {
+			if parseErr == nil {
 				earliestRetry = time.Now().Add(time.Duration(dur) * time.Second)
+			} else {
+				// Couldn't make sense of retry-after,
+				// so set retry to 20 seconds
+				earliestRetry = time.Now().Add(20 * time.Second)
 			}
 		}
-		if parseErr != nil {
-			// Couldn't make sense of retry-after,
-			// so set retry to 20 seconds
-			earliestRetry = time.Now().Add(20 * time.Second)
-		}
 		return &AzureRateLimitError{*rq, earliestRetry}
 	}
 	if rq.ServiceError == nil {
@@ -251,10 +250,14 @@ func (az *AzureInstanceSet) setup(azcfg AzureInstanceSetConfig, dispatcherID str
 
 	az.ctx, az.stopFunc = context.WithCancel(context.Background())
 	go func() {
+		az.stopWg.Add(1)
+		defer az.stopWg.Done()
+
 		tk := time.NewTicker(5 * time.Minute)
 		for {
 			select {
 			case <-az.ctx.Done():
+				tk.Stop()
 				return
 			case <-tk.C:
 				az.ManageBlobs()
@@ -504,9 +507,6 @@ func (az *AzureInstanceSet) ManageNics() (map[string]network.Interface, error) {
 // leased to a VM) and haven't been modified for
 // DeleteDanglingResourcesAfter seconds.
 func (az *AzureInstanceSet) ManageBlobs() {
-	az.stopWg.Add(1)
-	defer az.stopWg.Done()
-
 	result, err := az.storageAcctClient.ListKeys(az.ctx, az.azconfig.ResourceGroup, az.azconfig.StorageAccount)
 	if err != nil {
 		az.logger.WithError(err).Warn("Couldn't get account keys")
diff --git a/lib/cloud/gocheck_test.go b/lib/cloud/gocheck_test.go
new file mode 100644
index 000000000..d8392686a
--- /dev/null
+++ b/lib/cloud/gocheck_test.go
@@ -0,0 +1,16 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+package cloud
+
+import (
+	"testing"
+
+	check "gopkg.in/check.v1"
+)
+
+// Gocheck boilerplate
+func Test(t *testing.T) {
+	check.TestingT(t)
+}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list