From ff585ac7c26a5e6ffeacfa93d8a908270cc37629 Mon Sep 17 00:00:00 2001 From: snowy Date: Fri, 16 Aug 2024 21:44:27 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E6=96=B0=E5=A2=9E=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E5=AE=89=E5=85=A8=E5=85=B1=E4=BA=AB=E5=86=85=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E5=AD=98=E5=99=A8(=E6=B3=A8=E9=87=8A)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteyuki/comm/storage.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/liteyuki/comm/storage.py b/liteyuki/comm/storage.py index 3453caf3..4821d470 100644 --- a/liteyuki/comm/storage.py +++ b/liteyuki/comm/storage.py @@ -4,16 +4,19 @@ """ import threading -from typing import Any, Optional +from typing import Optional -from liteyuki.utils import IS_MAIN_PROCESS from liteyuki.comm.channel import Channel +from liteyuki.utils import IS_MAIN_PROCESS if IS_MAIN_PROCESS: _locks = {} -def _get_lock(key): +def _get_lock(key) -> threading.Lock: + """ + 获取锁 + """ if IS_MAIN_PROCESS: if key not in _locks: _locks[key] = threading.Lock()