types fixes
This commit is contained in:
@@ -22,11 +22,13 @@ REGISTRY: Dict[str, type] = {}
|
||||
|
||||
|
||||
# Перехватчики для журнала запросов SQLAlchemy
|
||||
# noinspection PyUnusedLocal
|
||||
@event.listens_for(Engine, 'before_cursor_execute')
|
||||
def before_cursor_execute(conn, cursor, statement, parameters, context, executemany):
|
||||
conn.query_start_time = time.time()
|
||||
|
||||
|
||||
# noinspection PyUnusedLocal
|
||||
@event.listens_for(Engine, 'after_cursor_execute')
|
||||
def after_cursor_execute(conn, cursor, statement, parameters, context, executemany):
|
||||
if hasattr(conn, '_query_start_time'):
|
||||
@@ -36,6 +38,7 @@ def after_cursor_execute(conn, cursor, statement, parameters, context, executema
|
||||
logger.debug(f"\n{statement}\n{'*' * math.floor(elapsed)} {elapsed:.3f} s")
|
||||
|
||||
|
||||
# noinspection PyUnusedLocal
|
||||
def local_session(src=''):
|
||||
return Session(bind=engine, expire_on_commit=False)
|
||||
|
||||
|
@@ -77,7 +77,7 @@ async def update_follows_for_user(
|
||||
await redis.execute('SET', redis_key, json.dumps(follows))
|
||||
|
||||
|
||||
async def handle_author_follower_change(connection, author_id, follower_id, is_insert):
|
||||
async def handle_author_follower_change(connection, author_id: int, follower_id: int, is_insert: bool):
|
||||
q = select(Author).filter(Author.id == author_id)
|
||||
authors = get_authors_with_stat(q)
|
||||
author = authors[0]
|
||||
@@ -102,7 +102,7 @@ async def handle_author_follower_change(connection, author_id, follower_id, is_i
|
||||
)
|
||||
|
||||
|
||||
async def handle_topic_follower_change(connection, topic_id, follower_id, is_insert):
|
||||
async def handle_topic_follower_change(connection, topic_id: int, follower_id: int, is_insert: bool):
|
||||
q = select(Topic).filter(Topic.id == topic_id)
|
||||
topics = get_topics_with_stat(q)
|
||||
topic = topics[0]
|
||||
|
@@ -65,7 +65,7 @@ class ViewedStorage:
|
||||
logger.info(f' * Миграция проводилась: {self.start_date}')
|
||||
|
||||
# Запуск фоновой задачи
|
||||
asyncio.create_task(self.worker())
|
||||
_task = asyncio.create_task(self.worker())
|
||||
else:
|
||||
logger.info(' * Пожалуйста, добавьте ключевой файл Google Analytics')
|
||||
self.disabled = True
|
||||
@@ -84,6 +84,7 @@ class ViewedStorage:
|
||||
except Exception as e:
|
||||
logger.error(f'Ошибка загрузки предварительно подсчитанных просмотров: {e}')
|
||||
|
||||
# noinspection PyTypeChecker
|
||||
@staticmethod
|
||||
async def update_pages():
|
||||
"""Запрос всех страниц от Google Analytics, отсортированных по количеству просмотров"""
|
||||
|
Reference in New Issue
Block a user