fix(server): harden job eviction and worker against missing job id
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -41,3 +41,15 @@ def test_run_job_failure_sets_failed():
|
||||
|
||||
def test_get_unknown_job_returns_none():
|
||||
assert jobs.get_job("nope") is None
|
||||
|
||||
|
||||
def test_eviction_keeps_within_cap():
|
||||
jobs.JOBS.clear()
|
||||
for i in range(jobs._MAX_JOBS + 25):
|
||||
jobs.create_job(hit={"i": i}, message="m")
|
||||
assert len(jobs.JOBS) <= jobs._MAX_JOBS
|
||||
jobs.JOBS.clear()
|
||||
|
||||
|
||||
def teardown_module():
|
||||
jobs.JOBS.clear()
|
||||
|
||||
Reference in New Issue
Block a user