Skip to content

Commit 17d5b7b

Browse files
committed
add comments to magic numbers
1 parent 5e67520 commit 17d5b7b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

turbopack/crates/turbo-tasks-backend/src/backend/operation/leaf_distance_update.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ use crate::{
1818
data::CachedDataItem,
1919
};
2020

21+
/// The maximum number of leaf distance updates to process before yielding back to the executor.
22+
/// This prevents long blocking operations and allows to interrupt the processing for persistent
23+
/// caching.
2124
const MAX_COUNT_BEFORE_YIELD: usize = 1000;
25+
26+
/// We avoid incrementing the leaf distance by 1 each time to avoid frequent updates.
27+
/// Instead we use a buffer zone that shrinks as the leaf distance increases.
28+
/// This constant defines the size of that buffer zone at leaf distance 0.
2229
const BASE_LEAF_DISTANCE_BUFFER: u32 = 128;
2330

2431
/// An leaf distance update job that is enqueued.

0 commit comments

Comments
 (0)