diff options
| author | 2026-04-28 10:45:41 +0200 | |
|---|---|---|
| committer | 2026-04-28 10:45:41 +0200 | |
| commit | b8d5952b83e7601c5df646efd976879f0dbd30c2 (patch) | |
| tree | 6366e383f6fc484e96a7e618015374561452d841 /ttun_server/redis.py | |
| parent | d93199684f159d59ef62e4c90d16516f6fd9526e (diff) | |
| download | server-b8d5952b83e7601c5df646efd976879f0dbd30c2.tar.gz server-b8d5952b83e7601c5df646efd976879f0dbd30c2.tar.bz2 server-b8d5952b83e7601c5df646efd976879f0dbd30c2.zip | |
Fixed issue with the redis proxy queue not working due to enqueing on the wrong queuev2.2.1
Diffstat (limited to 'ttun_server/redis.py')
| -rw-r--r-- | ttun_server/redis.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/ttun_server/redis.py b/ttun_server/redis.py index 18fbca2..fb9ff81 100644 --- a/ttun_server/redis.py +++ b/ttun_server/redis.py | |||
| @@ -1,19 +1,13 @@ | |||
| 1 | import asyncio | ||
| 2 | import os | 1 | import os |
| 3 | from asyncio import get_running_loop | ||
| 4 | 2 | ||
| 5 | from redis.asyncio import ConnectionPool, Redis | 3 | from redis.asyncio import ConnectionPool, Redis |
| 6 | 4 | ||
| 7 | 5 | ||
| 8 | class RedisConnectionPool: | 6 | class RedisConnectionPool: |
| 9 | instance: 'RedisConnectionPool' = None | 7 | _pool: ConnectionPool | None = None |
| 10 | |||
| 11 | def __init__(self): | ||
| 12 | self.pool = ConnectionPool.from_url(os.environ.get('REDIS_URL')) | ||
| 13 | 8 | ||
| 14 | @classmethod | 9 | @classmethod |
| 15 | def get_connection(cls) -> Redis: | 10 | def get_connection(cls) -> Redis: |
| 16 | if cls.instance is None: | 11 | if cls._pool is None: |
| 17 | cls.instance = RedisConnectionPool() | 12 | cls._pool = ConnectionPool.from_url(os.environ.get('REDIS_URL')) |
| 18 | 13 | return Redis(connection_pool=cls._pool) \ No newline at end of file | |
| 19 | return Redis(connection_pool=cls.instance.pool) | ||
