相同hash 更新 source_url
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
"""项目入口:初始化数据源、加载字典、启动调度器"""
|
"""项目入口:初始化数据源、加载字典、启动调度器"""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import logging
|
||||||
import signal
|
import signal
|
||||||
import warnings
|
import warnings
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@@ -9,6 +10,7 @@ from app.core.logger import log
|
|||||||
|
|
||||||
# 屏蔽 asyncmy INSERT IGNORE 产生的 Duplicate entry warnings
|
# 屏蔽 asyncmy INSERT IGNORE 产生的 Duplicate entry warnings
|
||||||
warnings.filterwarnings("ignore", message=".*Duplicate entry.*")
|
warnings.filterwarnings("ignore", message=".*Duplicate entry.*")
|
||||||
|
logging.getLogger("asyncmy").setLevel(logging.ERROR)
|
||||||
from app.core.database import init_db, close_db
|
from app.core.database import init_db, close_db
|
||||||
from app.services.dict_cache_service import dict_cache
|
from app.services.dict_cache_service import dict_cache
|
||||||
from app.scheduler.tasks import create_scheduler
|
from app.scheduler.tasks import create_scheduler
|
||||||
|
|||||||
@@ -98,8 +98,8 @@ async def _do_clean(data: dict) -> None:
|
|||||||
if existing_id:
|
if existing_id:
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
await mysql.execute(
|
await mysql.execute(
|
||||||
text("UPDATE bg_job SET status = 0, create_time = :now, update_time = :now WHERE id = :id"),
|
text("UPDATE bg_job SET status = 0, source_url = :url, create_time = :now, update_time = :now WHERE id = :id"),
|
||||||
{"now": now, "id": existing_id},
|
{"url": data.get("detail_url"), "now": now, "id": existing_id},
|
||||||
)
|
)
|
||||||
await mysql.commit()
|
await mysql.commit()
|
||||||
await _update_pg_status(data_id, "cleaned")
|
await _update_pg_status(data_id, "cleaned")
|
||||||
|
|||||||
Reference in New Issue
Block a user