fix(douyu): 稳定绑定轮询并留档角色接口响应
This commit is contained in:
@@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
|
||||
import os
|
||||
import uuid
|
||||
from datetime import UTC, datetime
|
||||
from datetime import UTC, datetime, timedelta
|
||||
|
||||
from loguru import logger
|
||||
from sqlalchemy import and_, func, or_, select
|
||||
@@ -56,6 +56,8 @@ SUPPORTED_DOUYU_TASK_TYPES = {
|
||||
"exchange_xpd_goods": "兑换小店商品",
|
||||
}
|
||||
|
||||
BINDING_POLL_CLEANUP_GRACE_SECONDS = 120
|
||||
|
||||
DOUYU_HANDBOOK_SCOPES = {"elite", "esports", "peace"}
|
||||
DOUYU_HANDBOOK_TASK_TYPES = {
|
||||
"elite": {
|
||||
@@ -476,7 +478,8 @@ def cleanup_orphan_douyu_tasks(
|
||||
DouyuTask.queue_lane == "binding_poll",
|
||||
DouyuTask.next_run_at.isnot(None),
|
||||
DouyuTask.run_deadline_at.isnot(None),
|
||||
DouyuTask.run_deadline_at > now,
|
||||
DouyuTask.run_deadline_at
|
||||
> now - timedelta(seconds=BINDING_POLL_CLEANUP_GRACE_SECONDS),
|
||||
)
|
||||
durable_payment = and_(
|
||||
DouyuTask.task_type.in_(
|
||||
|
||||
Reference in New Issue
Block a user