optimal es conn pool

This commit is contained in:
liuzhihang1
2025-03-07 06:59:10 +00:00
parent f78a280110
commit 7c19f12050

View File

@@ -4,6 +4,7 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"net/http"
"reflect" "reflect"
"github.com/lzh-1625/go_process_manager/config" "github.com/lzh-1625/go_process_manager/config"
@@ -32,6 +33,11 @@ func (e *esLogic) InitEs() bool {
elastic.SetURL(config.CF.EsUrl), elastic.SetURL(config.CF.EsUrl),
elastic.SetBasicAuth(config.CF.EsUsername, config.CF.EsPassword), elastic.SetBasicAuth(config.CF.EsUsername, config.CF.EsPassword),
elastic.SetSniff(false), elastic.SetSniff(false),
elastic.SetHttpClient(&http.Client{
Transport: &http.Transport{
MaxIdleConnsPerHost: config.CF.LogHandlerPoolSize,
},
}),
) )
if err != nil { if err != nil {
config.CF.EsEnable = false config.CF.EsEnable = false