mirror of
https://github.com/jeessy2/ddns-go.git
synced 2025-10-20 15:33:46 +08:00
fix: Fix the problem that ip cache time is one less (#712)
This commit is contained in:
2
main.go
2
main.go
@ -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")
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user