From b73f0ae2c98d22773b01ab52c8098710af7defbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Thu, 5 Oct 2023 23:08:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=9C=A8=E6=96=87=E4=BB=B6Hash?= =?UTF-8?q?=E6=97=B6=E5=8A=A0=E5=85=A5=E9=98=B2=E6=97=A0=E9=99=90=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/caches/list_file_hash_map.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/caches/list_file_hash_map.go b/internal/caches/list_file_hash_map.go index 0895617..6a2652c 100644 --- a/internal/caches/list_file_hash_map.go +++ b/internal/caches/list_file_hash_map.go @@ -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