Skip to content

Commit

Permalink
fix consistency issue with reading collectibles (vercel/turborepo#3878)
Browse files Browse the repository at this point in the history
connect original task to collectibles reading to fix strongly consistency

move read collectibles tasks to task and scope instead of a separate cache

reading collectibles is no longer strongly consistent by default, it's opt-in now
  • Loading branch information
sokra authored Feb 21, 2023
1 parent 6b79da8 commit e706b72
Show file tree
Hide file tree
Showing 13 changed files with 854 additions and 381 deletions.
10 changes: 8 additions & 2 deletions crates/turbo-tasks-memory/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use turbo_tasks::{
TaskId, TurboTasksBackendApi,
};

use crate::MemoryBackend;

#[derive(Default, Debug)]
pub(crate) enum Cell {
/// No content has been set yet, or it was removed for memory pressure
Expand Down Expand Up @@ -204,7 +206,11 @@ impl Cell {
}
}

pub fn assign(&mut self, content: CellContent, turbo_tasks: &dyn TurboTasksBackendApi) {
pub fn assign(
&mut self,
content: CellContent,
turbo_tasks: &dyn TurboTasksBackendApi<MemoryBackend>,
) {
match self {
Cell::Empty => {
*self = Cell::Value {
Expand Down Expand Up @@ -287,7 +293,7 @@ impl Cell {
}

/// Drops the cell after GC. Will notify all dependent tasks and events.
pub fn gc_drop(self, turbo_tasks: &dyn TurboTasksBackendApi) {
pub fn gc_drop(self, turbo_tasks: &dyn TurboTasksBackendApi<MemoryBackend>) {
match self {
Cell::Empty => {}
Cell::Recomputing {
Expand Down
2 changes: 1 addition & 1 deletion crates/turbo-tasks-memory/src/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl GcQueue {
&self,
factor: u8,
backend: &MemoryBackend,
turbo_tasks: &dyn TurboTasksBackendApi,
turbo_tasks: &dyn TurboTasksBackendApi<MemoryBackend>,
) -> Option<(GcPriority, usize, GcStats)> {
// Process through the inactive propagation queue.
while let Ok(task) = self.inactive_propagate_queue.pop() {
Expand Down
Loading

0 comments on commit e706b72

Please sign in to comment.