Skip to content

Commit

Permalink
fix task id reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Aug 9, 2024
1 parent 639b5a7 commit 3a08002
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions turbopack/crates/turbo-tasks-memory/src/memory_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ use turbo_tasks::{
},
event::EventListener,
util::{IdFactoryWithReuse, NoMoveVec},
CellId, RawVc, TaskId, TaskIdSet, TraitTypeId, TurboTasksBackendApi, Unused, ValueTypeId,
TRANSIENT_TASK_BIT,
CellId, RawVc, TaskId, TaskIdSet, TaskInput, TraitTypeId, TurboTasksBackendApi, Unused,
ValueTypeId, TRANSIENT_TASK_BIT,
};

use crate::{
Expand Down Expand Up @@ -272,8 +272,13 @@ impl MemoryBackend {
drop(entry);
unsafe {
task_storage.remove(index);
let new_id = Unused::new_unchecked(new_id);
turbo_tasks.reuse_persistent_task_id(new_id);
if new_id.is_transient() {
let new_id = Unused::new_unchecked(new_id);
turbo_tasks.reuse_transient_task_id(new_id);
} else {
let new_id = Unused::new_unchecked(new_id);
turbo_tasks.reuse_persistent_task_id(new_id);
}
}
task_id
}
Expand Down

0 comments on commit 3a08002

Please sign in to comment.