turborepo
b321cd01 - fix: allow multiple threads to share hash tracker (#6012)

Commit
2 years ago
fix: allow multiple threads to share hash tracker (#6012) ### Description When executing a task, it might need to update the hash tracker with: - cache status - expanded output globs or it might need to query the env vars. Since task execution happens on multiple threads we need to ensure that the state portion can be shared between threads. This is achieved with a good ol' `Arc<Mutex>` around the mutable state. In Go we do the same thing, but with a `RWLock`, this can be ported in the future if we find that there's enough contention for the mutex. (I'm currently unconvinced this is necessary considering how infrequently reads happen) I'm holding off on the cache status portion of the hash tracker since that depends on run summary code and I don't want to conflict with #5833 ### Testing Instructions New test ensures that we can share the underlying state between threads since it is `Send + Sync`. Closes TURBO-1350 Co-authored-by: Chris Olszewski <Chris Olszewski>
Parents
Loading