From 6151d8a7878fd6032bdd91649bc3060850f47b2c Mon Sep 17 00:00:00 2001 From: doumao Date: Sat, 28 Feb 2026 22:13:54 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BD=BF=E7=94=A8deque=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=BB=BF=E8=81=94=E5=AA=92=E4=BD=93=E5=BA=93=E9=81=8D?= =?UTF-8?q?=E5=8E=86=E9=98=9F=E5=88=97=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/modules/ugreen/ugreen.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/modules/ugreen/ugreen.py b/app/modules/ugreen/ugreen.py index 66786c6a..ccc0da97 100644 --- a/app/modules/ugreen/ugreen.py +++ b/app/modules/ugreen/ugreen.py @@ -1,4 +1,5 @@ import hashlib +from collections import deque from datetime import datetime from pathlib import Path from typing import Any, Dict, Generator, List, Mapping, Optional, Union @@ -767,12 +768,12 @@ class Ugreen: if not self._api or not root_path: return - queue: List[str] = [root_path] + queue = deque([root_path]) visited: set[str] = set() max_paths = 20000 while queue and len(visited) < max_paths: - current_path = queue.pop(0) + current_path = queue.popleft() if current_path in visited: continue visited.add(current_path)