File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
turbopack/crates/turbo-tasks-backend/src/backend Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -2031,15 +2031,31 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
20312031
20322032 fn mark_own_task_as_session_dependent (
20332033 & self ,
2034- task : TaskId ,
2034+ task_id : TaskId ,
20352035 turbo_tasks : & dyn TurboTasksBackendApi < TurboTasksBackend < B > > ,
20362036 ) {
20372037 if !self . should_track_dependencies ( ) {
20382038 // Without dependency tracking we don't need session dependent tasks
20392039 return ;
20402040 }
2041+ const SESSION_DEPENDENT_AGGREGATION_NUMBER : u32 = u32:: MAX >> 2 ;
20412042 let mut ctx = self . execute_context ( turbo_tasks) ;
2042- let mut task = ctx. task ( task, TaskDataCategory :: Data ) ;
2043+ let mut task = ctx. task ( task_id, TaskDataCategory :: Meta ) ;
2044+ let aggregation_number = get_aggregation_number ( & task) ;
2045+ if aggregation_number < SESSION_DEPENDENT_AGGREGATION_NUMBER {
2046+ drop ( task) ;
2047+ // We want to use a high aggregation number to avoid large aggregation chains for
2048+ // session dependent tasks (which change on every run)
2049+ AggregationUpdateQueue :: run (
2050+ AggregationUpdateJob :: UpdateAggregationNumber {
2051+ task_id,
2052+ base_aggregation_number : SESSION_DEPENDENT_AGGREGATION_NUMBER ,
2053+ distance : None ,
2054+ } ,
2055+ & mut ctx,
2056+ ) ;
2057+ task = ctx. task ( task_id, TaskDataCategory :: Meta ) ;
2058+ }
20432059 if let Some ( InProgressState :: InProgress ( box InProgressStateInner {
20442060 session_dependent,
20452061 ..
You can’t perform that action at this time.
0 commit comments