1.5.8-k8s-extnet-branch v1.6.0-beta
Nikita Sorokin 1 year ago
parent 0b3de4df7f
commit afcbc7e749

@ -1,6 +1,4 @@
## Version 1.5.7 ## Version 1.6.0-beta
### Bugfix ### Bugfix
- Remove the required tag of the start field in the CreateRequest model in cb/lb/create, since it is impossible to create an lb without starting it - Fixed RoudTrip bug in HTTP transport, made it concurrent safe
- Fix model the RecordGrid, add the ItemGridList model to cloudbroker/grid/models to correctly receive information on get and list requests
- Fix tag json field GID in model RecordResourcesConsumption cb/grid/models

@ -3,6 +3,7 @@ package client
import ( import (
"crypto/tls" "crypto/tls"
"net/http" "net/http"
"sync"
"time" "time"
"repository.basistech.ru/BASIS/decort-golang-sdk/config" "repository.basistech.ru/BASIS/decort-golang-sdk/config"
@ -32,6 +33,7 @@ func NewHttpClient(cfg config.Config) *http.Client {
ssoURL: cfg.SSOURL, ssoURL: cfg.SSOURL,
token: cfg.Token, token: cfg.Token,
expiryTime: expiredTime, expiryTime: expiredTime,
mutex: &sync.Mutex{},
//TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, //TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}, },

@ -4,6 +4,7 @@ import (
"crypto/tls" "crypto/tls"
"net/http" "net/http"
"net/url" "net/url"
"sync"
"time" "time"
"repository.basistech.ru/BASIS/decort-golang-sdk/config" "repository.basistech.ru/BASIS/decort-golang-sdk/config"
@ -33,6 +34,7 @@ func NewLegacyHttpClient(cfg config.LegacyConfig) *http.Client {
token: cfg.Token, token: cfg.Token,
decortURL: cfg.DecortURL, decortURL: cfg.DecortURL,
expiryTime: expiredTime, expiryTime: expiredTime,
mutex: &sync.Mutex{},
}, },
Timeout: cfg.Timeout.Get(), Timeout: cfg.Timeout.Get(),

@ -5,6 +5,7 @@ import (
"io" "io"
"net/http" "net/http"
"strings" "strings"
"sync"
"time" "time"
) )
@ -15,6 +16,7 @@ type transportLegacy struct {
retries uint64 retries uint64
token string token string
decortURL string decortURL string
mutex *sync.Mutex
expiryTime time.Time expiryTime time.Time
} }
@ -56,7 +58,9 @@ func (t *transportLegacy) RoundTrip(request *http.Request) (*http.Response, erro
var resp *http.Response var resp *http.Response
var err error var err error
for i := uint64(0); i < t.retries; i++ { for i := uint64(0); i < t.retries; i++ {
t.mutex.Lock()
resp, err = t.base.RoundTrip(req) resp, err = t.base.RoundTrip(req)
t.mutex.Unlock()
if err == nil { if err == nil {
if resp.StatusCode == 200 { if resp.StatusCode == 200 {
return resp, nil return resp, nil

@ -5,6 +5,7 @@ import (
"io" "io"
"net/http" "net/http"
"strings" "strings"
"sync"
"time" "time"
) )
@ -16,6 +17,7 @@ type transport struct {
token string token string
ssoURL string ssoURL string
expiryTime time.Time expiryTime time.Time
mutex *sync.Mutex
} }
func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) { func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
@ -53,7 +55,9 @@ func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
var resp *http.Response var resp *http.Response
var err error var err error
for i := uint64(0); i < t.retries; i++ { for i := uint64(0); i < t.retries; i++ {
t.mutex.Lock()
resp, err = t.base.RoundTrip(req) resp, err = t.base.RoundTrip(req)
t.mutex.Unlock()
if err == nil { if err == nil {
if resp.StatusCode == 200 { if resp.StatusCode == 200 {
return resp, nil return resp, nil
@ -65,5 +69,6 @@ func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) {
//logrus.Errorf("Could not execute request: %v. Retrying %d/%d", err, i+1, t.retries) //logrus.Errorf("Could not execute request: %v. Retrying %d/%d", err, i+1, t.retries)
time.Sleep(time.Second * 5) time.Sleep(time.Second * 5)
} }
return nil, fmt.Errorf("could not execute request: %w", err) return nil, fmt.Errorf("could not execute request: %w", err)
} }

Loading…
Cancel
Save