fix(flash): fix codeQL issue

@formatter:off

Signed-off-by: clinx <chenlin1@oppo.com>
This commit is contained in:
clinx 2025-12-26 11:06:37 +08:00 committed by chihe
parent 0b02c44208
commit 0bcdcee745
3 changed files with 3 additions and 11 deletions

View File

@ -48,7 +48,7 @@ var AddrDatabase = make(map[uint64]string)
type clusterConfig struct {
cfsProto.RemoteCacheConfig
httpProxyPoolSize uint64
httpProxyPoolSize int
heartbeatPort int64
replicaPort int64
peerAddrs []string

View File

@ -2,7 +2,6 @@ package flashgroupmanager
import (
"fmt"
"math"
"net/http"
"net/http/httputil"
"time"
@ -163,14 +162,8 @@ func (m *FlashGroupManager) registerAPIMiddleware(route *mux.Router) {
func (m *FlashGroupManager) newReverseProxy() *httputil.ReverseProxy {
tr := &http.Transport{}
if m.config != nil {
ps := m.config.httpProxyPoolSize // uint64
if ps > uint64(math.MaxInt) {
log.LogErrorf("newReverseProxy httpProxyPoolSize[%d] invalid", ps)
return nil
}
poolSize := int(ps)
tr = proto.GetHttpTransporter(&proto.HttpCfg{
PoolSize: poolSize,
PoolSize: m.config.httpProxyPoolSize,
})
}

View File

@ -200,8 +200,7 @@ func (m *FlashGroupManager) checkConfig(cfg *config.Config) (err error) {
if m.id, err = strconv.ParseUint(cfg.GetString(ID), 10, 64); err != nil {
return fmt.Errorf("%v,err:%v", proto.ErrInvalidCfg, err.Error())
}
m.config.httpProxyPoolSize = uint64(cfg.GetInt64(HttpReversePoolSize))
m.config.httpProxyPoolSize = cfg.GetInt(HttpReversePoolSize)
if m.config.httpProxyPoolSize < defaultHttpReversePoolSize {
m.config.httpProxyPoolSize = defaultHttpReversePoolSize
}