feat: 去掉停止按钮,等待中的任务也能暂停
This commit is contained in:
@@ -467,7 +467,7 @@ def test_running_count_ignores_paused_and_dead_tasks(tmp_path: Path):
|
||||
assert manager.running_count() == 0
|
||||
|
||||
|
||||
def test_request_stop_sets_stopping_and_requeue_clears_listing(tmp_path: Path):
|
||||
def test_requeue_clears_listing_and_queued_job_can_pause(tmp_path: Path):
|
||||
manager = JobManager()
|
||||
manager.max_concurrent = 1
|
||||
city = _job(tmp_path, whole_city=True)
|
||||
@@ -487,9 +487,25 @@ def test_request_stop_sets_stopping_and_requeue_clears_listing(tmp_path: Path):
|
||||
manager.jobs[holder.id] = holder
|
||||
assert manager.place(city) == "wait"
|
||||
assert city.listing_done is False
|
||||
manager.request_stop(holder)
|
||||
assert holder.stopping is True
|
||||
assert holder.message == "正在停止"
|
||||
manager.pause(city)
|
||||
assert city.status == "paused"
|
||||
assert not city.run_event.is_set()
|
||||
assert manager.queued_jobs() == []
|
||||
|
||||
|
||||
def test_jobs_paused_by_expiry_stay_paused_until_login(tmp_path: Path):
|
||||
manager = JobManager()
|
||||
waiting = _job(tmp_path)
|
||||
waiting.status = "queued"
|
||||
manager.jobs[waiting.id] = waiting
|
||||
manager.suspend_all("登录已失效,请重新登录", mark="expired")
|
||||
assert waiting.status == "paused"
|
||||
for item in manager.list_jobs():
|
||||
if item["id"] == waiting.id:
|
||||
assert item["status"] == "paused"
|
||||
assert waiting.status == "paused"
|
||||
manager.resume_marked("expired")
|
||||
assert waiting.status == "queued"
|
||||
|
||||
|
||||
def test_active_count_and_sse_removed(tmp_path: Path):
|
||||
|
||||
Reference in New Issue
Block a user