turborepo
8ca8b673 - fix(daemon): plumb through flush watch errors (#5070)

Commit
2 years ago
fix(daemon): plumb through flush watch errors (#5070) ### Description First pass as plumbing the status of watching the flush directory to the glob watcher and watcher configs. Notable changes: - Before we start to process flush commands we wait until we get confirmation that we are watching the flush directory so we can properly handle flush commands - Failing to watch the flush directory will cause the watch future held by the server to exit. The daemon server won't shut down, but will respond with errors to all glob watching related RPC requests Reviewer notes: - The current timeout logic means that if erroring on setting up the flush directory takes over 500ms we skip the flush and proceed as usual - We now return errors for `get_changed_outputs` RPC call - I'm unsure of the changes to the `serve` function. I've manually tested them, but they feel off. In the future when we possibly have multiple long running futures this won't scale. ### Testing Instructions Unit test should now consistently pass and not depend on watching the flush directory succeeding before the watcher is converted into a stream. Did some manual testing to make sure that we don't exit if glob watching fails and instead report an error to clients: From the daemon logs: ``` 2023-05-23T15:36:56.894-0700 [TRACE] globwatch: watching "/private/tmp/turborepo-netflix-cache-repro" 2023-05-23T15:36:56.898-0700 [TRACE] globwatch: watching flush dir: "/private/var/folders/3m/rxkycvgs5jgfvs0k9xcgp6 km0000gn/T/turbod/3e1692e405755b5a/flush" ERROR faked failure for globawatch ERROR Globwatch config error: ServerFailedToStart 2023-05-23T15:37:21.582-0700 [TRACE] log: registering event source with poller: token=Token(1), interests=READABLE | WRITABLE ``` From the turbo output: ``` web:build: Failed to check if we can skip restoring outputs for web#build: rpc error: code = Internal desc = failed to watch flush directory. Proceeding to check cache ``` --------- Co-authored-by: Chris Olszewski <Chris Olszewski>
Parents
Loading