Skip to content

Commit

Permalink
v3
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-pfus committed Dec 13, 2024
1 parent fd20716 commit a7186f5
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions gcs_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package gosnowflake

import (
"context"
"crypto/tls"
"encoding/json"
"fmt"
Expand Down Expand Up @@ -78,12 +77,7 @@ func (util *snowflakeGcsClient) getFileHeader(meta *fileMetadata, filename strin
if meta.mockGcsClient != nil {
client = meta.mockGcsClient
}
req.Close = true
r := newRetryHTTP(context.Background(), client, http.NewRequest, URL, gcsHeaders, time.Second, 3, defaultTimeProvider, nil) // TODO replace with timeout context
r.doHead()
fmt.Printf("Before calling HEAD to GCS\n")
resp, err := r.execute()
fmt.Printf("After calling HEAD to GCS, err: %v\n", err)
resp, err := client.Do(req)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -403,18 +397,20 @@ func (util *snowflakeGcsClient) isTokenExpired(resp *http.Response) bool {

func newGcsClient() gcsAPI {
return &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
RootCAs: certPool,
VerifyPeerCertificate: verifyPeerCertificateSerial,
},
MaxIdleConns: 10,
IdleConnTimeout: 30 * time.Minute,
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
},
Transport: gcsTransport,
}
}

var gcsTransport = &http.Transport{
TLSClientConfig: &tls.Config{
RootCAs: certPool,
VerifyPeerCertificate: verifyPeerCertificateSerial,
},
MaxIdleConns: 10,
IdleConnTimeout: 30 * time.Minute,
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
}

0 comments on commit a7186f5

Please sign in to comment.