Skip to content

Commit

Permalink
fix unloading stateful check (vercel/turborepo#8749)
Browse files Browse the repository at this point in the history
### Description

We need to move up the check so it prevents unloading tasks with state.

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
  • Loading branch information
sokra committed Jul 15, 2024
1 parent 175c2d6 commit 0ac6934
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions crates/turbo-tasks-memory/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1621,22 +1621,22 @@ impl Task {
}
state.gc.generation = None;

if active {
let mut cells_to_drop = Vec::new();

match &mut state.state_type {
TaskStateType::Done { stateful, edges: _ } => {
if *stateful {
return GcResult::NotPossible;
}
}
TaskStateType::Dirty { .. } => {}
_ => {
// GC can't run in this state. We will reschedule it when the execution
// completes.
match &mut state.state_type {
TaskStateType::Done { stateful, edges: _ } => {
if *stateful {
return GcResult::NotPossible;
}
}
TaskStateType::Dirty { .. } => {}
_ => {
// GC can't run in this state. We will reschedule it when the execution
// completes.
return GcResult::NotPossible;
}
}

if active {
let mut cells_to_drop = Vec::new();

// shrinking memory and dropping cells
state.aggregation_node.shrink_to_fit();
Expand Down

0 comments on commit 0ac6934

Please sign in to comment.