You've already forked VptPassiveAdapter
优化http连接池
This commit is contained in:
@@ -26,8 +26,7 @@ func QueryUploadUrlForTask(ctx context.Context, taskId string) (string, error) {
|
||||
log.Println("Error creating request:", err)
|
||||
return "", err
|
||||
}
|
||||
client := &http.Client{}
|
||||
resp, err := client.Do(req)
|
||||
resp, err := GetAPIClient().Do(req)
|
||||
if err != nil {
|
||||
span.SetAttributes(attribute.String("error", err.Error()))
|
||||
span.SetStatus(codes.Error, "发送请求失败")
|
||||
@@ -62,8 +61,7 @@ func ReportTaskFailure(ctx context.Context, taskId string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
client := &http.Client{}
|
||||
resp, err := client.Do(req)
|
||||
resp, err := GetAPIClient().Do(req)
|
||||
if err != nil {
|
||||
span.SetAttributes(attribute.String("error", err.Error()))
|
||||
span.SetStatus(codes.Error, "发送请求失败")
|
||||
@@ -107,8 +105,7 @@ func ReportTaskSuccess(ctx context.Context, taskId string, file *dto.FileObject)
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
client := &http.Client{}
|
||||
resp, err := client.Do(req)
|
||||
resp, err := GetAPIClient().Do(req)
|
||||
if err != nil {
|
||||
span.SetAttributes(attribute.String("error", err.Error()))
|
||||
span.SetStatus(codes.Error, "发送请求失败")
|
||||
|
Reference in New Issue
Block a user