fixed-fmt-linted
Some checks failed
deploy to v2 / test (push) Failing after 49s
deploy to v2 / deploy (push) Has been skipped

This commit is contained in:
2024-02-17 02:56:15 +03:00
parent 2163e85b16
commit 8b39b47714
17 changed files with 384 additions and 391 deletions

View File

@@ -1,12 +1,13 @@
import json
import redis.asyncio as aredis
import asyncio
from settings import REDIS_URL
import json
import logging
logger = logging.getLogger("\t[services.redis]\t")
import redis.asyncio as aredis
from settings import REDIS_URL
logger = logging.getLogger('\t[services.redis]\t')
logger.setLevel(logging.DEBUG)
@@ -26,11 +27,11 @@ class RedisCache:
async def execute(self, command, *args, **kwargs):
if self._client:
try:
logger.debug(command + " " + " ".join(args))
logger.debug(command + ' ' + ' '.join(args))
r = await self._client.execute_command(command, *args, **kwargs)
return r
except Exception as e:
logger.error(f"{e}")
logger.error(f'{e}')
return None
async def subscribe(self, *channels):
@@ -60,15 +61,15 @@ class RedisCache:
while True:
message = await pubsub.get_message()
if message and isinstance(message["data"], (str, bytes, bytearray)):
logger.debug("pubsub got msg")
if message and isinstance(message['data'], (str, bytes, bytearray)):
logger.debug('pubsub got msg')
try:
yield json.loads(message["data"]), message.get("channel")
yield json.loads(message['data']), message.get('channel')
except Exception as e:
logger.error(f"{e}")
logger.error(f'{e}')
await asyncio.sleep(1)
redis = RedisCache()
__all__ = ["redis"]
__all__ = ['redis']