Unverified Commit a35c03d4 authored by vercel-fleet-prod[bot]'s avatar vercel-fleet-prod[bot] Committed by GitHub

test: await completed root before GC disposal assertion

Co-authored-by: 's avatarLuke Sandberg <210140+lukesandberg@users.noreply.github.com>
parent 0202c583
...@@ -8,7 +8,7 @@ mod util; ...@@ -8,7 +8,7 @@ mod util;
use std::sync::Arc; use std::sync::Arc;
use anyhow::Result; use anyhow::Result;
use turbo_tasks::{ResolvedVc, TaskId, Vc, prevent_gc}; use turbo_tasks::{ReadConsistency, ResolvedVc, TaskId, Vc, prevent_gc};
use crate::{ use crate::{
gc_fixture::{Constant, Selector, create_constant, create_selector}, gc_fixture::{Constant, Selector, create_constant, create_selector},
...@@ -239,6 +239,18 @@ async fn dispose_root_task_releases_anchored_subgraph() { ...@@ -239,6 +239,18 @@ async fn dispose_root_task_releases_anchored_subgraph() {
}); });
let leaf_id = rx.await.unwrap(); let leaf_id = rx.await.unwrap();
// The oneshot is sent before the root future returns. Disposal during that window preserves
// the root until its in-progress execution settles, so a single GC pass may collect only the
// leaf. Wait for the root and its dependencies before testing disposal of a completed root.
let tt_for_wait = tt.clone();
turbo_tasks::run_once(tt.clone(), async move {
tt_for_wait
.wait_task_completion(root_id, ReadConsistency::Strong)
.await?;
anyhow::Ok(())
})
.await
.unwrap();
for _ in 0..100 { for _ in 0..100 {
if tt.backend().transient_ref_count_for_testing(leaf_id) > 0 { if tt.backend().transient_ref_count_for_testing(leaf_id) > 0 {
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment