fmt+refactor
All checks were successful
Deploy on push / deploy (push) Successful in 24s

This commit is contained in:
2024-02-23 19:35:40 +03:00
parent 14947225a6
commit e80b3ac770
9 changed files with 307 additions and 119 deletions

View File

@@ -34,12 +34,7 @@ async def check_auth(req):
logger.debug(f'{token}')
query_name = 'validate_jwt_token'
operation = 'ValidateToken'
variables = {
'params': {
'token_type': 'access_token',
'token': token,
}
}
variables = {'params': {'token_type': 'access_token', 'token': token}}
gql = {
'query': f'query {operation}($params: ValidateJWTTokenInput!) {{'

View File

@@ -33,9 +33,7 @@ def after_cursor_execute(conn, cursor, statement, parameters, context, executema
elapsed = time.time() - conn.query_start_time
del conn.query_start_time
if elapsed > 0.9: # Adjust threshold as needed
logger.debug(
f"\n{statement}\n{'*' * math.floor(elapsed)} {elapsed:.3f} s"
)
logger.debug(f"\n{statement}\n{'*' * math.floor(elapsed)} {elapsed:.3f} s")
def local_session(src=''):

View File

@@ -12,13 +12,11 @@ from services.rediscache import redis
DEFAULT_FOLLOWS = {
'topics': [],
'authors': [],
'communities': [
{'slug': 'discours', 'name': 'Дискурс', 'id': 1, 'desc': ''}
],
'communities': [{'slug': 'discours', 'name': 'Дискурс', 'id': 1, 'desc': ''}],
}
async def update_author(author: Author, ttl = 25 * 60 * 60):
async def update_author(author: Author, ttl=25 * 60 * 60):
redis_key = f'user:{author.user}:author'
await redis.execute('SETEX', redis_key, ttl, json.dumps(author.dict()))