Skip to content

Commit

Permalink
set root type on root tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Aug 13, 2024
1 parent cfead87 commit 21e9206
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion turbopack/crates/turbo-tasks-backend/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use self::{operation::ExecuteContext, storage::Storage};
use crate::{
data::{
CachedDataItem, CachedDataItemKey, CachedDataItemValue, CachedDataUpdate, CellRef,
InProgressState, OutputValue,
InProgressState, OutputValue, RootType,
},
get, remove,
utils::{bi_map::BiMap, chunked_vec::ChunkedVec, ptr_eq_arc::PtrEqArc},
Expand Down Expand Up @@ -665,11 +665,16 @@ impl Backend for TurboTasksBackend {
turbo_tasks: &dyn TurboTasksBackendApi<Self>,
) -> TaskId {
let task_id = self.transient_task_id_factory.get();
let root_type = match task_type {
TransientTaskType::Root(_) => RootType::RootTask,
TransientTaskType::Once(_) => RootType::OnceTask,
};
self.transient_tasks
.insert(task_id, Arc::new(tokio::sync::Mutex::new(task_type)));
{
let mut task = self.storage.access_mut(task_id);
task.add(CachedDataItem::new_scheduled(task_id));
task.add(CachedDataItem::AggregateRootType { value: root_type });
}
turbo_tasks.schedule(task_id);
task_id
Expand Down
4 changes: 2 additions & 2 deletions turbopack/crates/turbo-tasks-backend/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ impl OutputValue {

#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum RootType {
_RootTask,
_OnceTask,
RootTask,
OnceTask,
_ReadingStronglyConsistent,
}

Expand Down

0 comments on commit 21e9206

Please sign in to comment.