增加清空Map
This commit is contained in:
parent
612cc35514
commit
390fb8cdd0
9
main.go
9
main.go
@ -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) // 防止高频运行
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user