From d28024a69b7c1571db199e140a1d4cafaa5d20c0 Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 29 Feb 2024 13:04:25 +0300 Subject: [PATCH] logs-fix --- resolvers/author.py | 5 +++-- services/viewed.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/resolvers/author.py b/resolvers/author.py index 53879bd2..077c0f64 100644 --- a/resolvers/author.py +++ b/resolvers/author.py @@ -78,8 +78,9 @@ async def get_author_by_user_id(user_id: str): res = await redis.execute('GET', redis_key) if isinstance(res, str): author = json.loads(res) - if author.get('id'): - logger.debug(f'got author @{author.slug} #{author.id} cached today') + author_id = author.get('id') + if author_id: + logger.debug(f'got author @{author.slug} #{author_id} cached today') return author q = select(Author).filter(Author.user == user_id) diff --git a/services/viewed.py b/services/viewed.py index ec0a1026..33794ab4 100644 --- a/services/viewed.py +++ b/services/viewed.py @@ -208,8 +208,9 @@ class ViewedStorage: try: await self.update_pages() failed = 0 - except Exception as _exc: + except Exception as exc: failed += 1 + logger.debug(exc) logger.info(' - Обновление не удалось #%d, ожидание 10 секунд' % failed) if failed > 3: logger.info(' - Больше не пытаемся обновить')