Skip to content

Commit

Permalink
improve task aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Sep 5, 2024
1 parent 74d0359 commit d2651c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
19 changes: 5 additions & 14 deletions turbopack/crates/turbo-tasks-backend/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,21 +640,12 @@ impl Backend for TurboTasksBackend {
task_id: TaskId,
turbo_tasks: &dyn TurboTasksBackendApi<Self>,
) {
if task_id.is_transient() {
return;
}
let ctx = self.execute_context(turbo_tasks);
let task = ctx.task(task_id);
let cell_data = task.iter().filter_map(|(key, value)| match (key, value) {
(CachedDataItemKey::CellData { cell }, CachedDataItemValue::CellData { value }) => {
Some(CachedDataUpdate {
task: task_id,
key: CachedDataItemKey::CellData { cell: *cell },
value: Some(CachedDataItemValue::CellData {
value: value.clone(),
}),
})
}
_ => None,
});
self.persisted_storage_log.lock().extend(cell_data);
let mut task = ctx.task(task_id);
task.invalidate_serialization();
}

fn get_task_description(&self, task: TaskId) -> std::string::String {
Expand Down
4 changes: 4 additions & 0 deletions turbopack/crates/turbo-tasks-backend/src/backend/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ impl PersistanceState {
self.value += 1;
}

pub fn add_persisting_items(&mut self, count: u32) {
self.value += count;
}

pub fn finish_persisting_items(&mut self, count: u32) {
self.value -= count;
}
Expand Down

0 comments on commit d2651c8

Please sign in to comment.