mirror of
https://github.com/d3vyce/taskiq-deduplication.git
synced 2026-08-04 19:14:07 +00:00
fix: ty warnings
This commit is contained in:
@@ -2,8 +2,7 @@ import asyncio
|
|||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from collections.abc import Awaitable
|
from typing import Any
|
||||||
from typing import Any, cast
|
|
||||||
|
|
||||||
from pydantic import RedisDsn
|
from pydantic import RedisDsn
|
||||||
from redis.asyncio import Redis
|
from redis.asyncio import Redis
|
||||||
@@ -105,7 +104,7 @@ class RedisDeduplicationMiddleware(TaskiqMiddleware):
|
|||||||
for attempt in range(self.startup_retries):
|
for attempt in range(self.startup_retries):
|
||||||
client = Redis.from_url(str(self.redis_url))
|
client = Redis.from_url(str(self.redis_url))
|
||||||
try:
|
try:
|
||||||
await cast(Awaitable[bool], client.ping())
|
await client.ping()
|
||||||
self._redis = client
|
self._redis = client
|
||||||
self._release_script = self._redis.register_script(RELEASE_LUA_SCRIPT)
|
self._release_script = self._redis.register_script(RELEASE_LUA_SCRIPT)
|
||||||
self._refresh_script = self._redis.register_script(REFRESH_LUA_SCRIPT)
|
self._refresh_script = self._redis.register_script(REFRESH_LUA_SCRIPT)
|
||||||
|
|||||||
+1
-3
@@ -1,5 +1,3 @@
|
|||||||
from typing import Awaitable, cast
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import fakeredis.aioredis
|
import fakeredis.aioredis
|
||||||
from redis.asyncio import Redis
|
from redis.asyncio import Redis
|
||||||
@@ -22,7 +20,7 @@ async def fake_redis():
|
|||||||
async def real_redis():
|
async def real_redis():
|
||||||
client = Redis.from_url("redis://localhost:6379/15")
|
client = Redis.from_url("redis://localhost:6379/15")
|
||||||
try:
|
try:
|
||||||
await cast(Awaitable[bool], client.ping())
|
await client.ping()
|
||||||
except Exception:
|
except Exception:
|
||||||
await client.aclose()
|
await client.aclose()
|
||||||
pytest.skip("Redis not available at localhost:6379")
|
pytest.skip("Redis not available at localhost:6379")
|
||||||
|
|||||||
Reference in New Issue
Block a user