mirror of
https://github.com/aykhans/dodo.git
synced 2025-04-20 19:13:06 +00:00
🎨 auto formatted
This commit is contained in:
parent
c2ce8e587b
commit
75ada96d35
@ -518,7 +518,7 @@ func getSharedRandomClientDoFunc(
|
|||||||
clientsCount int,
|
clientsCount int,
|
||||||
timeout time.Duration,
|
timeout time.Duration,
|
||||||
) ClientDoFunc {
|
) ClientDoFunc {
|
||||||
return func (ctx context.Context, request *fasthttp.Request) (*fasthttp.Response, error) {
|
return func(ctx context.Context, request *fasthttp.Request) (*fasthttp.Response, error) {
|
||||||
client := &clients[rand.Intn(clientsCount)]
|
client := &clients[rand.Intn(clientsCount)]
|
||||||
defer client.CloseIdleConnections()
|
defer client.CloseIdleConnections()
|
||||||
response := fasthttp.AcquireResponse()
|
response := fasthttp.AcquireResponse()
|
||||||
@ -554,12 +554,13 @@ func getSharedRandomClientDoFunc(
|
|||||||
// Otherwise, it returns the response and nil.
|
// Otherwise, it returns the response and nil.
|
||||||
// - If the timeout duration is reached, it releases the response and returns nil and a custom timeout error.
|
// - If the timeout duration is reached, it releases the response and returns nil and a custom timeout error.
|
||||||
// - If the context is canceled, it returns nil and a custom interrupt error.
|
// - If the context is canceled, it returns nil and a custom interrupt error.
|
||||||
|
//
|
||||||
// The function ensures that idle connections are closed by calling client.CloseIdleConnections() using a defer statement.
|
// The function ensures that idle connections are closed by calling client.CloseIdleConnections() using a defer statement.
|
||||||
func getSharedClientDoFunc(
|
func getSharedClientDoFunc(
|
||||||
client *fasthttp.HostClient,
|
client *fasthttp.HostClient,
|
||||||
timeout time.Duration,
|
timeout time.Duration,
|
||||||
) ClientDoFunc {
|
) ClientDoFunc {
|
||||||
return func (ctx context.Context, request *fasthttp.Request) (*fasthttp.Response, error) {
|
return func(ctx context.Context, request *fasthttp.Request) (*fasthttp.Response, error) {
|
||||||
defer client.CloseIdleConnections()
|
defer client.CloseIdleConnections()
|
||||||
response := fasthttp.AcquireResponse()
|
response := fasthttp.AcquireResponse()
|
||||||
ch := make(chan error)
|
ch := make(chan error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user