Skip to content

Commit

Permalink
取消重试
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Feb 27, 2023
1 parent 3872299 commit 3e8ee0f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions http/httpRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ func httpRequest(methodName string, requestUrl string, head map[string]any, body
sw := stopwatch.StartNew()

client := fasthttp.Client{}

client.RetryIf = func(request *fasthttp.Request) bool {
return false
}
// request
request := fasthttp.AcquireRequest()

Expand Down Expand Up @@ -66,8 +68,11 @@ func httpRequest(methodName string, requestUrl string, head map[string]any, body

// Method
request.Header.SetMethod(methodName)

response := fasthttp.AcquireResponse()
defer fasthttp.ReleaseRequest(request)
defer fasthttp.ReleaseResponse(response)
defer request.SetConnectionClose()

timeout := time.Duration(requestTimeout) * time.Millisecond
err := client.DoTimeout(request, response, timeout)

Expand Down

0 comments on commit 3e8ee0f

Please sign in to comment.