MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / SharedHttpClient

Function SharedHttpClient

internal/utils/http.go:45–56  ·  view source on GitHub ↗

SharedHttpClient 获取一个公用的Client

(timeout time.Duration)

Source from the content-addressed store, hash-verified

43
44// SharedHttpClient 获取一个公用的Client
45func SharedHttpClient(timeout time.Duration) *http.Client {
46 timeoutClientLocker.Lock()
47 defer timeoutClientLocker.Unlock()
48
49 client, ok := timeoutClientMap[timeout]
50 if ok {
51 return client
52 }
53 client = NewHTTPClient(timeout)
54 timeoutClientMap[timeout] = client
55 return client
56}

Callers 3

doURLMethod · 0.92
action_block.goFile · 0.92
TestSharedHTTPClientFunction · 0.85

Calls 3

NewHTTPClientFunction · 0.70
LockMethod · 0.45
UnlockMethod · 0.45

Tested by 1

TestSharedHTTPClientFunction · 0.68