Skip to content

Concurrent requests with one resty client? #556

Closed Answered by nicoxiang
jo-me asked this question in Q&A
Discussion options

You must be logged in to vote

I asked a similar question before, see #542 , and i got the answer

You only need one instance of the client which be used to create any number of requests

And as described in the README Resty design section

goroutine concurrent safe

In the resty source code, resty.New() function will create golang standard http.Client , and the docs also said:

The Client's Transport typically has internal state (cached TCP connections), so Clients should be reused instead of created as needed. Clients are safe for concurrent use by multiple goroutines.

Related issue: #328

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jeevatkm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants