mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Use custom transport for site replication (#14391)
Also, ensure that tiering uses a different instance of custom transport
This commit is contained in:
@@ -21,8 +21,10 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/minio/madmin-go"
|
||||
@@ -31,6 +33,12 @@ import (
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
)
|
||||
|
||||
// getRemoteTierTargetInstanceTransport contains a singleton roundtripper.
|
||||
var (
|
||||
getRemoteTierTargetInstanceTransport http.RoundTripper
|
||||
getRemoteTierTargetInstanceTransportOnce sync.Once
|
||||
)
|
||||
|
||||
type warmBackendS3 struct {
|
||||
client *minio.Client
|
||||
core *minio.Core
|
||||
@@ -109,13 +117,13 @@ func newWarmBackendS3(conf madmin.TierS3) (*warmBackendS3, error) {
|
||||
} else {
|
||||
creds = credentials.NewStaticV4(conf.AccessKey, conf.SecretKey, "")
|
||||
}
|
||||
getRemoteTargetInstanceTransportOnce.Do(func() {
|
||||
getRemoteTargetInstanceTransport = newGatewayHTTPTransport(10 * time.Minute)
|
||||
getRemoteTierTargetInstanceTransportOnce.Do(func() {
|
||||
getRemoteTierTargetInstanceTransport = newGatewayHTTPTransport(10 * time.Minute)
|
||||
})
|
||||
opts := &minio.Options{
|
||||
Creds: creds,
|
||||
Secure: u.Scheme == "https",
|
||||
Transport: getRemoteTargetInstanceTransport,
|
||||
Transport: getRemoteTierTargetInstanceTransport,
|
||||
}
|
||||
client, err := minio.New(u.Host, opts)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user