From 492533dcdbf5ee36b1a64c73575952e0609755a4 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 13 Apr 2024 18:38:29 +0800 Subject: [PATCH] rollback #1884 --- app/utils/singleton.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/utils/singleton.py b/app/utils/singleton.py index 057531d6..ece2355c 100644 --- a/app/utils/singleton.py +++ b/app/utils/singleton.py @@ -8,14 +8,12 @@ class Singleton(abc.ABCMeta, type): """ _instances: dict = {} - _lock = threading.Lock() def __call__(cls, *args, **kwargs): key = (cls, args, frozenset(kwargs.items())) - with cls._lock: - if key not in cls._instances: - cls._instances[key] = super().__call__(*args, **kwargs) - return cls._instances[key] + if key not in cls._instances: + cls._instances[key] = super().__call__(*args, **kwargs) + return cls._instances[key] class AbstractSingleton(abc.ABC, metaclass=Singleton):