Skip to content

Commit

Permalink
fix aioredis
Browse files Browse the repository at this point in the history
  • Loading branch information
dungeon-master-666 committed Nov 12, 2023
1 parent 614a517 commit debfd60
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions ton-http-api/pyTON/api/deps/ton.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pyTON.core.tonlib.manager import TonlibManager
from pyTON.core.cache import DisabledCacheManager
from pyTON.core.cache import CacheManager, RedisCacheManager
from pyTON.core.cache import CacheManager, DisabledCacheManager, RedisCacheManager
from pyTON.core.settings import RedisCacheSettings, Settings

from fastapi import Depends
Expand Down
4 changes: 2 additions & 2 deletions ton-http-api/pyTON/core/cache.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import aioredis
import redis.asyncio
import ring

from ring.func.asyncio import Aioredis2Storage
Expand Down Expand Up @@ -29,7 +29,7 @@ def wrapper(*args, **kwargs):
class RedisCacheManager:
def __init__(self, cache_settings: RedisCacheSettings):
self.cache_settings = cache_settings
self.cache_redis = aioredis.from_url(f"redis://{cache_settings.redis.endpoint}:{cache_settings.redis.port}")
self.cache_redis = redis.asyncio.from_url(f"redis://{cache_settings.redis.endpoint}:{cache_settings.redis.port}")

def cached(self, expire=0, check_error=True):
storage_class = TonlibResultRedisStorage if check_error else Aioredis2Storage
Expand Down
4 changes: 2 additions & 2 deletions ton-http-api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
aioredis>=2.0.1
redis==5.0.1
loguru>=0.6.0
fastapi==0.90.0
pydantic>=1.2.0,<2.0.0
requests>=2.28.0
ring>=0.9.1
ring==0.10.1
uvicorn>=0.17.6
gunicorn>=20.1.0
pytonlib>=0.0.50
Expand Down
4 changes: 2 additions & 2 deletions ton-http-api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
version=version,
packages=find_packages('.', exclude=['tests']),
install_requires=[
'aioredis>=2.0.1',
'redis==5.0.1',
'loguru>=0.6.0',
'fastapi>=0.78.0',
'pydantic>=1.9.1',
'requests>=2.28.0',
'ring>=0.9.1',
'ring==0.10.1',
'uvicorn>=0.17.6',
'gunicorn>=20.1.0',
'pytonlib>=0.0.48',
Expand Down

0 comments on commit debfd60

Please sign in to comment.