next.js
ee6cf0c5 - simplify session dependent tasks (#91729) (#93227)

Commit
168 days ago
simplify session dependent tasks (#91729) (#93227) ## Summary This is a re-application of #91729 without the TTL support (fetch `Cache-Control` and `TransientState` changes are excluded). ### Make `session_dependent` a function attribute Previously, tasks called `mark_session_dependent()` at runtime to flag themselves. This PR makes it a compile-time `#[turbo_tasks::function(session_dependent)]` attribute instead. Benefits: - **Enables eager aggregation number selection**: Session-dependent tasks change on every session restore, behaving like dirty leaf nodes. By knowing at task creation time (not mid-execution) that a task is session-dependent, the backend can assign a high initial aggregation number, preventing long dirty-propagation chains through intermediate aggregated nodes. - **Simpler API**: No runtime `mark_session_dependent()` call needed — the attribute is declarative and statically checked. - Removes `mark_session_dependent()`, `mark_own_task_as_session_dependent()`, and the `session_dependent` field from `InProgressStateInner`. The backend now reads `is_session_dependent` directly from the `NativeFunction` metadata via `TaskGuard::is_session_dependent()`. ## Test Plan - Existing tests continue to pass - `cargo check -p turbo-tasks -p turbo-tasks-backend -p turbo-tasks-fetch` ## Why was #91729 reverted? The original attempt seemed to be triggering OOMs on front. Through debugging there were no obvious ways in which it was tied to this change but rather due to invalidation races which motivated changes like #92389 to remove races from restore paths and #92814 which eliminated some expensive errors from eventually consistent executions. <!-- NEXT_JS_LLM_PR -->
Author
Parents
Loading