mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-04 06:15:14 +08:00
fix(cache): type async Redis loop registries
This commit is contained in:
10
app/adapters/cache/redis.py
vendored
10
app/adapters/cache/redis.py
vendored
@@ -382,8 +382,12 @@ class AsyncRedisHelper(ConfigReloadMixin, metaclass=Singleton):
|
||||
self.redis_url = get_runtime_setting('CACHE_BACKEND_URL')
|
||||
self.client: Optional[Redis] = None
|
||||
self._loop: Optional[asyncio.AbstractEventLoop] = None
|
||||
self._clients: weakref.WeakKeyDictionary = weakref.WeakKeyDictionary()
|
||||
self._connect_locks: weakref.WeakKeyDictionary = weakref.WeakKeyDictionary()
|
||||
self._clients: weakref.WeakKeyDictionary[
|
||||
asyncio.AbstractEventLoop, Redis
|
||||
] = weakref.WeakKeyDictionary()
|
||||
self._connect_locks: weakref.WeakKeyDictionary[
|
||||
asyncio.AbstractEventLoop, asyncio.Lock
|
||||
] = weakref.WeakKeyDictionary()
|
||||
self._state_lock = threading.RLock()
|
||||
|
||||
def _get_connect_lock(self, current_loop: asyncio.AbstractEventLoop) -> asyncio.Lock:
|
||||
@@ -422,7 +426,7 @@ class AsyncRedisHelper(ConfigReloadMixin, metaclass=Singleton):
|
||||
"""
|
||||
current_loop = asyncio.get_running_loop()
|
||||
connect_lock = self._get_connect_lock(current_loop)
|
||||
client = None
|
||||
client: Optional[Redis] = None
|
||||
try:
|
||||
async with connect_lock:
|
||||
with self._state_lock:
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
"app/adapters/cache/redis.py": {
|
||||
"arg-type": 9,
|
||||
"no-any-return": 2,
|
||||
"no-untyped-call": 21,
|
||||
"no-untyped-def": 16,
|
||||
"no-untyped-call": 12,
|
||||
"no-untyped-def": 15,
|
||||
"return-value": 2,
|
||||
"str-bytes-safe": 2,
|
||||
"union-attr": 27
|
||||
"union-attr": 14
|
||||
},
|
||||
"app/adapters/external/cookiecloud.py": {
|
||||
"arg-type": 1
|
||||
|
||||
Reference in New Issue
Block a user