Skip to content

Commit fcc98a6

Browse files
committed
restore the previous organization
1 parent 8f9c591 commit fcc98a6

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

  • turbopack/crates/turbo-tasks-backend/src/backend

turbopack/crates/turbo-tasks-backend/src/backend/mod.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -917,21 +917,20 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
917917
let wall_start = SystemTime::now();
918918
debug_assert!(self.should_persist());
919919

920-
// Enter the snapshot phase: blocks until all in-flight operations
921-
// drain or suspend, then collects the suspended-operations list.
922-
// Holding the phase keeps new operations queued; we drop it after
923-
// `start_snapshot()` so the snapshot mode is entered atomically with
924-
// operations still suspended (preventing missed modifications).
925-
let (snapshot_guard, has_modifications, suspended_operations) = {
920+
let mut snapshot_phase = {
926921
let _span = tracing::info_span!("blocking").entered();
927-
let mut phase = self.snapshot_coord.begin_snapshot();
928-
let suspended_operations = phase.take_suspended_operations();
929-
let (g, hm) = self.storage.start_snapshot();
922+
self.snapshot_coord.begin_snapshot()
930923
// `phase` drops here, releasing the snapshot bit and waking any
931924
// operations parked on `snapshot_completed`.
932-
(g, hm, suspended_operations)
933925
};
926+
// Enter snapshot mode, which atomically reads and resets the modified count.
927+
// Checking after start_snapshot ensures no concurrent increments can race.
928+
let (snapshot_guard, has_modifications) = self.storage.start_snapshot();
929+
930+
let suspended_operations = snapshot_phase.take_suspended_operations();
931+
934932
let snapshot_time = Instant::now();
933+
drop(snapshot_phase);
935934

936935
if !has_modifications {
937936
// No tasks modified since the last snapshot — drop the guard (which

0 commit comments

Comments
 (0)