fix(douyu): 对齐绑定小程序码并修复残留任务停止
This commit is contained in:
@@ -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"),
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user