Skip to content

Commit

Permalink
fix(api,cdn): set timeout for swift client (#6614)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardlt authored Sep 5, 2023
1 parent 2c8cc0f commit 77e252e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
14 changes: 8 additions & 6 deletions engine/api/objectstore/swift.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ func newSwiftStore(ctx context.Context, integration sdk.ProjectIntegration, conf
log.Info(ctx, "ObjectStore> Initialize Swift driver on url: %s", conf.Address)
s := &SwiftStore{
Connection: swift.Connection{
AuthUrl: conf.Address,
Region: conf.Region,
Tenant: conf.Tenant,
Domain: conf.Domain,
UserName: conf.Username,
ApiKey: conf.Password,
AuthUrl: conf.Address,
Region: conf.Region,
Tenant: conf.Tenant,
Domain: conf.Domain,
UserName: conf.Username,
ApiKey: conf.Password,
ConnectTimeout: time.Minute * 1,
Timeout: time.Minute * 10,
},
containerPrefix: conf.ContainerPrefix,
disableTempURL: conf.DisableTempURL,
Expand Down
15 changes: 9 additions & 6 deletions engine/cdn/storage/swift/swift.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"net/url"
"strings"
"time"

"github.com/go-gorp/gorp"
"github.com/ncw/swift"
Expand Down Expand Up @@ -46,12 +47,14 @@ func (s *Swift) Init(_ context.Context, cfg interface{}) error {
s.config = *config
s.ConvergentEncryption = encryption.New(config.Encryption)
s.client = swift.Connection{
AuthUrl: config.Address,
Region: config.Region,
Tenant: config.Tenant,
Domain: config.Domain,
UserName: config.Username,
ApiKey: config.Password,
AuthUrl: config.Address,
Region: config.Region,
Tenant: config.Tenant,
Domain: config.Domain,
UserName: config.Username,
ApiKey: config.Password,
ConnectTimeout: time.Minute * 1,
Timeout: time.Minute * 10,
}
return sdk.WithStack(s.client.Authenticate())
}
Expand Down

0 comments on commit 77e252e

Please sign in to comment.