fix(watchers): re-arm a stopped TeamWatcher watcher from the poll

chokidar 3 reports a one-off ENOENT race (a new file gone between its
stat and its watch) through the same TypeError as a lasting EMFILE, so a
watcher that stayed closed ended live team and task updates until a
restart. Each poll tick now re-creates a stopped watcher, as
WorkflowRunWatcher already does, and an outage warns once rather than
once per attempt. Also imports getErrorMessage from the types barrel.
This commit is contained in:
JD committed 2026-11-19 02:52:40 -05:00
1 parent 10e443a309
commit c7b6e1cb4e
4 files changed
+290 -16

No files matched your search

+2 -1
View File
@@ -26,7 +26,8 @@ import type { FSWatcher } from 'chokidar';
/**
* Close `watcher` on its first `'error'` and pass that error to `onClosed`,
* once. The caller's polling has to cover what the watcher watched.
* once. The caller's polling has to cover what the watcher watched and create it
* again later: chokidar 3 reports a one-off ENOENT race through the same error.
*/
export function closeWatcherOnError(watcher: FSWatcher, onClosed: (err: unknown) => void): void {
watcher.once('error', (err: unknown) => {