projects
/
arvados.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
36bbbee
)
10468: Add RequestTimeout to Azure volume config.
author
Tom Clegg <tom@curoverse.com>
Mon, 7 Nov 2016 15:32:01 +0000
(10:32 -0500)
committer
Tom Clegg <tom@curoverse.com>
Mon, 7 Nov 2016 15:32:01 +0000
(10:32 -0500)
services/keepstore/azure_blob_volume.go
patch
|
blob
|
history
diff --git
a/services/keepstore/azure_blob_volume.go
b/services/keepstore/azure_blob_volume.go
index d2163f6b490376768383b260444d6be90a9ca1ed..d2c4620066cf7f88d8374f5331e64e822df760be 100644
(file)
--- a/
services/keepstore/azure_blob_volume.go
+++ b/
services/keepstore/azure_blob_volume.go
@@
-8,6
+8,7
@@
import (
"io"
"io/ioutil"
"log"
"io"
"io/ioutil"
"log"
+ "net/http"
"os"
"regexp"
"strconv"
"os"
"regexp"
"strconv"
@@
-15,9
+16,12
@@
import (
"sync"
"time"
"sync"
"time"
+ "git.curoverse.com/arvados.git/sdk/go/arvados"
"github.com/curoverse/azure-sdk-for-go/storage"
)
"github.com/curoverse/azure-sdk-for-go/storage"
)
+const azureDefaultRequestTimeout = arvados.Duration(10 * time.Minute)
+
var (
azureMaxGetBytes int
azureStorageAccountName string
var (
azureMaxGetBytes int
azureStorageAccountName string
@@
-95,6
+99,7
@@
type AzureBlobVolume struct {
ContainerName string
AzureReplication int
ReadOnly bool
ContainerName string
AzureReplication int
ReadOnly bool
+ RequestTimeout arvados.Duration
azClient storage.Client
bsClient storage.BlobStorageClient
azClient storage.Client
bsClient storage.BlobStorageClient
@@
-108,6
+113,7
@@
func (*AzureBlobVolume) Examples() []Volume {
StorageAccountKeyFile: "/etc/azure_storage_account_key.txt",
ContainerName: "example-container-name",
AzureReplication: 3,
StorageAccountKeyFile: "/etc/azure_storage_account_key.txt",
ContainerName: "example-container-name",
AzureReplication: 3,
+ RequestTimeout: azureDefaultRequestTimeout,
},
}
}
},
}
}
@@
-133,6
+139,13
@@
func (v *AzureBlobVolume) Start() error {
if err != nil {
return fmt.Errorf("creating Azure storage client: %s", err)
}
if err != nil {
return fmt.Errorf("creating Azure storage client: %s", err)
}
+
+ if v.RequestTimeout == 0 {
+ v.RequestTimeout = azureDefaultRequestTimeout
+ }
+ v.azClient.HTTPClient = &http.Client{
+ Timeout: time.Duration(v.RequestTimeout),
+ }
v.bsClient = v.azClient.GetBlobService()
ok, err := v.bsClient.ContainerExists(v.ContainerName)
v.bsClient = v.azClient.GetBlobService()
ok, err := v.bsClient.ContainerExists(v.ContainerName)