feat: use memory usage for selection (#12909)

This commit is contained in:
jif-oai
2026-02-26 16:44:02 +00:00
committed by GitHub
parent 1503a8dad7
commit c528f32acb
8 changed files with 329 additions and 16 deletions
+10 -4
View File
@@ -559,7 +559,7 @@ mod phase2 {
#[tokio::test]
async fn dispatch_reclaims_stale_global_lock_and_starts_consolidation() {
let harness = DispatchHarness::new().await;
harness.seed_stage1_output(100).await;
harness.seed_stage1_output(Utc::now().timestamp()).await;
let stale_claim = harness
.state_db
@@ -573,12 +573,18 @@ mod phase2 {
phase2::run(&harness.session, Arc::clone(&harness.config)).await;
let running_claim = harness
let post_dispatch_claim = harness
.state_db
.try_claim_global_phase2_job(ThreadId::new(), 3_600)
.await
.expect("claim while running");
pretty_assertions::assert_eq!(running_claim, Phase2JobClaimOutcome::SkippedRunning);
.expect("claim after stale lock dispatch");
assert!(
matches!(
post_dispatch_claim,
Phase2JobClaimOutcome::SkippedRunning | Phase2JobClaimOutcome::SkippedNotDirty
),
"stale-lock dispatch should either keep the reclaimed job running or finish it before re-claim"
);
let user_input_ops = harness.user_input_ops_count();
pretty_assertions::assert_eq!(user_input_ops, 1);