mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 19:29:36 +08:00
`test_scheduler_renews_lease_during_a_long_sync` ran a 200 ms lease with a 40 ms renewal and then compared the deadline against `time.time()`. On the Python 3.12 runner the event loop was delayed past the deadline and the assertion read `1793772763914 > 1793772763951` — 37 ms short. The test was really asserting that the runner schedules an asyncio task within 200 ms, which it does not promise. The lease is now 5 s with a renewal every 0.5 s, and the check runs after 1.2 s with the database left alone in between. That still proves the lease is extended while a sync is running, and it cannot lose the race. Reproduction before the change: 0/20 failures idle, 1/10 with four busy loops on a 2-vCPU box. After: 0/20 idle and 0/20 under the same load. Found while debugging, deliberately not changed here: `_renew_lease()` does not catch exceptions from `renew_lease()`, and the task's exception is swallowed by `asyncio.gather(..., return_exceptions=True)` in `_run_job`'s `finally`. One transient SQLite error therefore ends the renewal loop silently, and the sync loses its lease with nothing logged. That deserves its own change and its own test.