Skip to content

Commit

Permalink
Add hystrix client
Browse files Browse the repository at this point in the history
  • Loading branch information
DiscoFighter47 committed Jul 2, 2019
1 parent f4a3553 commit bea0b65
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions clients/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@ import (
"sync"
"time"

"github.com/gojektech/heimdall/httpclient"
"github.com/gojektech/heimdall/hystrix"
)

const path = "/hello/zahid"
const maxReq = 5000
const maxReq = 10000

var counter = 0
var lock sync.Mutex
var client *httpclient.Client
var client *hystrix.Client

func init() {
timeout := 15 * time.Second
client = httpclient.NewClient(httpclient.WithHTTPTimeout(timeout))
client = hystrix.NewClient(
hystrix.WithHTTPTimeout(10*time.Second),
hystrix.WithCommandName("hello server request"),
hystrix.WithHystrixTimeout(10*time.Second),
hystrix.WithMaxConcurrentRequests(1000),
hystrix.WithErrorPercentThreshold(20),
)
}

func print(val int) {
Expand Down

0 comments on commit bea0b65

Please sign in to comment.