Skip to content

Commit

Permalink
updating values bind throttle decrese per sec and removed unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
rajesh-1983 committed Apr 19, 2024
1 parent a2a3b1b commit 8828ef5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 1 addition & 6 deletions lib/bindevict.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ func (entry *BindThrottle) decrAllowEveryX(y int) {
}
updateCopy[k] = v
}
if len(updateCopy) > 0 {
bindEvict.BindThrottle[entry.Sqlhash] = updateCopy
} else {
delete(bindEvict.BindThrottle, entry.Sqlhash)
}
gBindEvict.Store(bindEvict)
}
}
Expand All @@ -128,7 +123,7 @@ func (bindEvict *BindEvict) ShouldBlock(sqlhash uint32, bindKV map[string]string
entryTime := time.Now()
defer func() {
if logger.GetLogger().V(logger.Verbose) {
logger.GetLogger().Log(logger.Info, fmt.Sprintf("bind throttle check operation exec duration is %v microseconds Bind-eviction decrese per sec %v", time.Now().Sub(entryTime).Microseconds(), GetConfig().BindEvictionDecrPerSec))
logger.GetLogger().Log(logger.Info, fmt.Sprintf("bind throttle check operation exec duration is %v microseconds and Bind-eviction-decrease/sec %v", time.Now().Sub(entryTime).Microseconds(), GetConfig().BindEvictionDecrPerSec))
}
}()
bindEvict.lock.Lock()
Expand Down
4 changes: 3 additions & 1 deletion lib/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ package lib
import (
"errors"
"fmt"
"math"
"os"
"path/filepath"
"strconv"
"strings"
"sync/atomic"

Expand Down Expand Up @@ -421,7 +423,7 @@ func InitConfig() error {
default_evict_names := fmt.Sprintf("id,num,%s", SrcPrefixAppKey)
gAppConfig.BindEvictionNames = cdb.GetOrDefaultString("bind_eviction_names", default_evict_names)
gAppConfig.BindEvictionThresholdPct = cdb.GetOrDefaultInt("bind_eviction_threshold_pct", 60)
fmt.Sscanf(cdb.GetOrDefaultString("bind_eviction_decr_per_sec", "10000000.0"),
fmt.Sscanf(cdb.GetOrDefaultString("bind_eviction_decr_per_sec", strconv.Itoa(math.MaxInt32)),
"%f", &gAppConfig.BindEvictionDecrPerSec)

gAppConfig.SkipEvictRegex = cdb.GetOrDefaultString("skip_eviction_host_prefix", "")
Expand Down

0 comments on commit 8828ef5

Please sign in to comment.