fix(douyu): 对齐绑定小程序码并修复残留任务停止

This commit is contained in:
yml
2026-11-22 22:15:48 +08:00
parent 5393b668e0
commit d315e983f6
9 changed files with 409 additions and 38 deletions
+22
View File
@@ -190,6 +190,28 @@ def test_cleanup_preserves_recoverable_binding_poll(db):
assert task.queue_lane == "binding_poll"
def test_force_cleanup_stops_recoverable_binding_poll(db):
_, _, task = _fixtures(db, status="running")
task.queue_lane = "binding_poll"
task.next_run_at = datetime.now(UTC) + timedelta(seconds=5)
task.run_deadline_at = datetime.now(UTC) + timedelta(minutes=10)
db.commit()
cleaned = douyu_service.cleanup_orphan_douyu_tasks(
db,
batch_id=task.batch_id,
statuses=("running",),
include_durable=True,
message="任务已停止(批次不存在)",
)
db.refresh(task)
assert cleaned == 1
assert task.status == "stopped"
assert task.queue_lane == ""
assert task.next_run_at is None
@pytest.mark.parametrize(
("elapsed", "expected"),
[