2023-11-26 13:43:39 +00:00
|
|
|
from asyncio.tasks import Task
|
2023-08-16 11:49:41 +00:00
|
|
|
from contextvars import ContextVar
|
2023-11-26 13:43:39 +00:00
|
|
|
from typing import List
|
2023-08-16 11:49:41 +00:00
|
|
|
|
2024-04-06 14:11:10 +00:00
|
|
|
import aiomysql
|
|
|
|
|
|
|
|
from async_db import AsyncMysqlDB
|
|
|
|
|
2023-08-16 11:49:41 +00:00
|
|
|
request_keyword_var: ContextVar[str] = ContextVar("request_keyword", default="")
|
2023-11-26 13:43:39 +00:00
|
|
|
crawler_type_var: ContextVar[str] = ContextVar("crawler_type", default="")
|
|
|
|
comment_tasks_var: ContextVar[List[Task]] = ContextVar("comment_tasks", default=[])
|
2024-04-06 14:11:10 +00:00
|
|
|
media_crawler_db_var: ContextVar[AsyncMysqlDB] = ContextVar("media_crawler_db_var")
|
|
|
|
db_conn_pool_var: ContextVar[aiomysql.Pool] = ContextVar("db_conn_pool_var")
|