Browse Source

fix lint

pull/339/head
yedf2 4 years ago
parent
commit
c79dc78fc9
  1. 4
      client/dtmcli/dtmimp/vars.go
  2. 1
      client/dtmcli/types.go

4
client/dtmcli/dtmimp/vars.go

@ -40,10 +40,14 @@ var BarrierTableName = "dtm_barrier.barrier"
var restyClients sync.Map
// GetRestyClient2 will return a resty client with timeout set
func GetRestyClient2(timeout time.Duration) *resty.Client {
cli, ok := restyClients.Load(timeout)
if !ok {
client := resty.New()
if timeout != 0 {
client.SetTimeout(timeout)
}
AddRestyMiddlewares(client)
restyClients.Store(timeout, client)
cli = client

1
client/dtmcli/types.go

@ -42,6 +42,7 @@ func GetRestyClient() *resty.Client {
return dtmimp.GetRestyClient2(0)
}
// GetRestyClient2 get the resty.Client with the specified timeout set
func GetRestyClient2(timeout time.Duration) *resty.Client {
return dtmimp.GetRestyClient2(timeout)
}

Loading…
Cancel
Save