next.js
21cb611d - Turbopack: fix race condition when adding dependencies (#84946)

Commit
156 days ago
Turbopack: fix race condition when adding dependencies (#84946) ### What? There is a race condition with the way we add the dependency backedges. We add the "dependent" edge first and in a separate lock the "dependency" edge. But if an invalidation happens just between these locks it do not invalidate the task as it's either still "outdated" or doesn't have a "dependency" edge yet. So we loose an invalidation. Adding the dependency first is also a bit problematic as task could be in progress, which won't cause a dependency to be added, or it could be untracked() which would only add the dependency when the task is an error. For now this fixes the race condition by locking both tasks at the same time. But that's not optimal for performance, especially for this common operation (reading a output or cell). As follow-up we need to look into something with better performance
Author
Parents
Loading