增加清空Map

This commit is contained in:
aixiao 2025-01-16 14:55:52 +08:00
parent 612cc35514
commit 390fb8cdd0
2 changed files with 9 additions and 0 deletions

BIN
denyip

Binary file not shown.

View File

@ -229,6 +229,15 @@ func runMainProcess() { // 主进程逻辑
return 0 return 0
}(), len(ProcessedIPMap)) }(), len(ProcessedIPMap))
// 清理 ProcessedIPMap
if len(ProcessedIPMap) >= 1024 {
ProcessedMutex.Lock() // 锁定互斥锁
ProcessedIPMap = make(map[string]struct{}) // 创建一个新的空 map
ProcessedMutex.Unlock() // 解锁
log.Println("ProcessedIPMap 已清空")
}
time.Sleep(1 * time.Second) // 防止高频运行 time.Sleep(1 * time.Second) // 防止高频运行
} }
}() }()