Skip to content

Commit

Permalink
fix: Fix the problem that ip cache time is one less (#712)
Browse files Browse the repository at this point in the history
  • Loading branch information
feranwq committed May 26, 2023
1 parent d69bbe6 commit 89166e6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var listen = flag.String("l", ":9876", "监听地址")
var every = flag.Int("f", 300, "同步间隔时间(秒)")

// 缓存次数
var ipCacheTimes = flag.Int("cacheTimes", 6, "间隔N次与服务商比对")
var ipCacheTimes = flag.Int("cacheTimes", 5, "间隔N次与服务商比对")

// 服务管理
var serviceType = flag.String("s", "", "服务管理, 支持install, uninstall")
Expand Down
4 changes: 2 additions & 2 deletions util/ip_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ func (d *IpCache) Check(newAddr string) bool {
if d.Addr != newAddr || d.Times <= 1 {
IPCacheTimes, err := strconv.Atoi(os.Getenv(IPCacheTimesENV))
if err != nil {
IPCacheTimes = 6
IPCacheTimes = 5
}
d.Addr = newAddr
d.Times = IPCacheTimes
d.Times = IPCacheTimes + 1
return true
}
d.Addr = newAddr
Expand Down

0 comments on commit 89166e6

Please sign in to comment.