diff options
| author | 2024-08-30 15:54:40 +0200 | |
|---|---|---|
| committer | 2024-08-30 15:54:40 +0200 | |
| commit | 0f7c975fe61dab4efb11b49ddc87331c30c26942 (patch) | |
| tree | 68f4b351b337b9a2269ddb2cb512016c93e7cbbc /ttun_server/redis.py | |
| parent | 53a8f300859a50d9f99f1821c35bca999fced6d8 (diff) | |
| parent | a72a0485ef8761b95c73cc420723247fafbb6f1c (diff) | |
| download | server-0f7c975fe61dab4efb11b49ddc87331c30c26942.tar.gz server-0f7c975fe61dab4efb11b49ddc87331c30c26942.tar.bz2 server-0f7c975fe61dab4efb11b49ddc87331c30c26942.zip | |
Added websocket support
Diffstat (limited to 'ttun_server/redis.py')
| -rw-r--r-- | ttun_server/redis.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/ttun_server/redis.py b/ttun_server/redis.py index 3065dec..18fbca2 100644 --- a/ttun_server/redis.py +++ b/ttun_server/redis.py | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | import asyncio | ||
| 1 | import os | 2 | import os |
| 3 | from asyncio import get_running_loop | ||
| 2 | 4 | ||
| 3 | from aioredis import ConnectionPool, Redis | 5 | from redis.asyncio import ConnectionPool, Redis |
| 4 | 6 | ||
| 5 | 7 | ||
| 6 | class RedisConnectionPool: | 8 | class RedisConnectionPool: |
| @@ -9,9 +11,6 @@ class RedisConnectionPool: | |||
| 9 | def __init__(self): | 11 | def __init__(self): |
| 10 | self.pool = ConnectionPool.from_url(os.environ.get('REDIS_URL')) | 12 | self.pool = ConnectionPool.from_url(os.environ.get('REDIS_URL')) |
| 11 | 13 | ||
| 12 | def __del__(self): | ||
| 13 | self.pool.disconnect() | ||
| 14 | |||
| 15 | @classmethod | 14 | @classmethod |
| 16 | def get_connection(cls) -> Redis: | 15 | def get_connection(cls) -> Redis: |
| 17 | if cls.instance is None: | 16 | if cls.instance is None: |
