mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2026-01-04 14:36:34 +08:00
加在文件Hash时加入防无限循环机制
This commit is contained in:
@@ -51,6 +51,7 @@ func (this *FileListHashMap) Load(db *FileListDB) error {
|
||||
this.isAvailable = true
|
||||
|
||||
var lastId int64
|
||||
var maxLoops = 50_000
|
||||
for {
|
||||
hashList, maxId, err := db.ListHashes(lastId)
|
||||
if err != nil {
|
||||
@@ -61,6 +62,11 @@ func (this *FileListHashMap) Load(db *FileListDB) error {
|
||||
}
|
||||
this.AddHashes(hashList)
|
||||
lastId = maxId
|
||||
|
||||
maxLoops --
|
||||
if maxLoops <= 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
this.isReady = true
|
||||
|
||||
Reference in New Issue
Block a user