fix(douyu): 修复斗鱼链路 P0/P1 隐患并增强 P2 运维队列可观测性

This commit is contained in:
yml
2026-11-29 14:10:24 +08:00
parent be7146a9ef
commit d12d9e02b3
51 changed files with 2510 additions and 561 deletions
+35 -19
View File
@@ -111,11 +111,16 @@ def _execute_storehome_sync(
if not manual_id:
raise RuntimeError("未配置精英宝典 manualID")
client = client_factory(account.cookie)
snapshot = snapshot_fetcher(
client,
manual_id=manual_id,
rid=rid,
)
try:
snapshot = snapshot_fetcher(
client,
manual_id=manual_id,
rid=rid,
)
finally:
close = getattr(client, "close", None)
if callable(close):
close()
result = sync_storehome_snapshot(
db,
account,
@@ -211,13 +216,18 @@ def _execute_profile_sync(
)
config = ensure_douyu_config(db)
client = client_factory(account.cookie)
probe = probe_fetcher(
account,
config,
client=client,
session_checker=None,
**_profile_probe_kwargs(item.work_type, config),
)
try:
probe = probe_fetcher(
account,
config,
client=client,
session_checker=None,
**_profile_probe_kwargs(item.work_type, config),
)
finally:
close = getattr(client, "close", None)
if callable(close):
close()
errors = probe.get("errors") or {}
domain_error = {
WORK_POINTS_SYNC: "points",
@@ -269,13 +279,19 @@ def _execute_exchange_records_sync(
session_checker=session_checker,
)
config = ensure_douyu_config(db)
result = sync_exchange_records(
db,
account,
client_factory(account.cookie),
config_mapping(config),
source=f"account_work.{item.work_type}",
)
client = client_factory(account.cookie)
try:
result = sync_exchange_records(
db,
account,
client,
config_mapping(config),
source=f"account_work.{item.work_type}",
)
finally:
close = getattr(client, "close", None)
if callable(close):
close()
return {
"ok": True,
"work_id": int(item.id),