fix(douyu): 修复斗鱼链路 P0/P1 隐患并增强 P2 运维队列可观测性
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user