Skip to content

Commit 6331e4b

Browse files
authored
fix: decouple list from watch (#995)
## Description Decouple failures in the list from the watch call. ## Related Issue Fixes # <!-- or --> Relates to # ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Other (security config, docs update, etc) ## Checklist before merging - [ ] Test, docs, adr added or updated as needed - [ ] [Contributor Guide Steps](https://docs.pepr.dev/main/contribute/#submitting-a-pull-request) followed Signed-off-by: Case Wylie <cmwylie19@defenseunicorns.com>
1 parent 5fca0a5 commit 6331e4b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/fluent/watch.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,14 @@ export class Watcher<T extends GenericClass> {
415415
* Watch for changes to the resource.
416416
*/
417417
#watch = async () => {
418+
// Start with a list operation, but don't let it block the watch stream
418419
try {
419-
// Start with a list operation
420420
await this.#list();
421+
} catch (listError) {
422+
this.#events.emit(WatchEvent.LIST_ERROR, listError);
423+
}
421424

425+
try {
422426
// Build the URL and request options
423427
const { opts, serverUrl } = await this.#buildURL(true, this.#resourceVersion);
424428

0 commit comments

Comments
 (0)