turborepo
4dc8d164 - fix(Turborepo): Start moving cookie watching to downstream services (#7283)

Commit
2 years ago
fix(Turborepo): Start moving cookie watching to downstream services (#7283) ### Description Filewatching cookies were ensuring that the filewatching task was up to date, but not downstream, filewatching-backed services. This change moves the filesystem cookie synchronization into a downstream service (glob watching) to ensure that RPCs are serviced by a task that has seen at least all of the operations that a client has done. The process is as follows: 1. A client of a filewatching-backed service uses a `CookieWriter` to stamp its request with a serial. 2. The CookieWriter requests a cookie file be written, and the serial returned to the client 3. The client forwards the request, now with a serial, to the filewatching-backed service 4. The service observes cookie files being created, and keeps track of the highest serial it has seen via a `CookieWatcher`. When a cookie file is observed, some pending requests may be returned as ready for servicing. 5. When the service gets a request, it checks via `CookieWatcher` if it has already seen the serial. If so, the request is handled immediately 6. If not, the service, again via the `CookieWatcher`, saves the request until the correct serial has been observed (step 4). This means that timeouts need to be handled by clients, but also gives clients the freedom to set their own timeouts. ### Testing Instructions Most cookie watching tests are gone, as is most of the logic. Instead, the mechanism is exercised via tests of downstream services. Closes TURBO-2244 --------- Co-authored-by: Greg Soltis <Greg Soltis>
Author
Greg Soltis
Parents
Loading