Skip to content

Commit

Permalink
notify tasks when collectibles change (vercel/turborepo#8776)
Browse files Browse the repository at this point in the history
### Description

Collectibles are removed in `execution_completed` and that might add
some tasks to the task local of tasks_to_notify. We need to make sure to
notify these tasks otherwise changes get lost.

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
  • Loading branch information
sokra authored Jul 17, 2024
1 parent b815b1c commit ab76201
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions crates/turbo-tasks-memory/src/memory_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ impl Backend for MemoryBackend {
reader: TaskId,
turbo_tasks: &dyn TurboTasksBackendApi<MemoryBackend>,
) -> AutoMap<RawVc, i32> {
Task::add_dependency_to_current(TaskEdge::Collectibles(id, trait_id));
Task::read_collectibles(id, trait_id, reader, self, turbo_tasks)
}

Expand Down
7 changes: 5 additions & 2 deletions crates/turbo-tasks/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,13 +523,16 @@ impl<B: Backend + 'static> TurboTasks<B> {
});
this.backend.task_execution_result(task_id, result, &*this);
let stateful = this.finish_current_task_state();
this.backend.task_execution_completed(
let schedule_again = this.backend.task_execution_completed(
task_id,
duration,
memory_usage,
stateful,
&*this,
)
);
// task_execution_completed might need to notify tasks
this.notify_scheduled_tasks();
schedule_again
}
.instrument(span)
.await
Expand Down

0 comments on commit ab76201

Please sign in to comment.