warn-not-found
All checks were successful
Deploy on push / deploy (push) Successful in 4s

This commit is contained in:
Untone 2024-12-12 00:20:43 +03:00
parent a1486b3bba
commit 7b58c7537e

View File

@ -20,10 +20,11 @@ from utils.logger import root_logger as logger
async def cache_by_id(entity, entity_id: int, cache_method): async def cache_by_id(entity, entity_id: int, cache_method):
caching_query = select(entity).filter(entity.id == entity_id) caching_query = select(entity).filter(entity.id == entity_id)
[x] = get_with_stat(caching_query) result = get_with_stat(caching_query)
if not x: if not result or not result[0]:
logger.warning(f"cache_by_id: {entity} with id {entity_id} not found")
return return
x = result[0]
d = x.dict() # convert object to dictionary d = x.dict() # convert object to dictionary
cache_method(d) cache_method(d)
return d return d