Skip to content

Commit

Permalink
v2
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-pfus committed Jan 15, 2025
1 parent 22483f0 commit f318b53
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions gcs_storage_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ package gosnowflake

import (
"context"
"crypto/tls"
"encoding/json"
"fmt"
"io"
"net"
"net/http"
"net/url"
"os"
"strconv"
"strings"
"time"
)

const (
Expand Down Expand Up @@ -81,7 +78,13 @@ func (util *snowflakeGcsClient) getFileHeader(meta *fileMetadata, filename strin
if meta.mockGcsClient != nil {
client = meta.mockGcsClient
}
return client.Do(req)
resp, err := client.Do(req)
println(err)
if err == io.EOF {
println("retrying because of EOF")
resp, err = client.Do(req)
}
return resp, err
})
if err != nil {
return nil, err
Expand Down Expand Up @@ -409,7 +412,7 @@ func (util *snowflakeGcsClient) isTokenExpired(resp *http.Response) bool {

func newGcsClient() gcsAPI {
return &http.Client{
Transport: gcsTransport,
Transport: SnowflakeTransport,
}
}

Expand All @@ -425,17 +428,3 @@ func getGcsCustomEndpoint(info *execResponseStageInfo) string {
}
return endpoint
}

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 f318b53

Please sign in to comment.