Scale biz_state collects with dedicated workers and non-blocking UI poll.

Add PG claim/NE mutex, persist pool, and biz_state_worker replicas; fix double-SSH and row-count bugs; stop 32m collectNow while-loop from freezing page switches.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-22 17:00:37 +08:00
parent 0eb65a839e
commit 3a0de0d7fb
22 changed files with 1210 additions and 165 deletions

View file

@ -88,6 +88,21 @@ class BizStateCollectRecoveryTests(unittest.TestCase):
assert ok is not None
self.assertEqual(ok.status, "success")
def test_queued_batch_also_marked_partial(self) -> None:
q = BizStateBatch(
id="b_q",
task_id="t1",
status="queued",
message="queued",
)
self.db.add(q)
self.db.commit()
out = recover_interrupted_collects_on_startup(self.db)
self.assertGreaterEqual(out["batches"], 2)
self.db.refresh(q)
self.assertEqual(q.status, "partial")
self.assertIn("interrupted_by_restart", q.message or "")
if __name__ == "__main__":
unittest.main()