From e21370e6239c7a65ed4b9ede7cad5ae4d821bd8c Mon Sep 17 00:00:00 2001 From: Case Wylie Date: Mon, 1 Jul 2024 13:04:08 -0400 Subject: [PATCH] chore: fixes bug in log message around RECONNECT events (#931) ## Description Fixes bug in log message around `RECONNECT` events, it was expecting two arguments when only one is emitted. There is additional context in this [comment](https://github.com/defenseunicorns/pepr/issues/930#issuecomment-2200391666) on the issue. ## Related Issue Fixes #930 Relates to # ## Type of change - [x] 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 - [x] Test, docs, adr added or updated as needed - [x] [Contributor Guide Steps](https://docs.pepr.dev/main/contribute/#submitting-a-pull-request) followed --------- Signed-off-by: Case Wylie Co-authored-by: Barrett <81570928+btlghrants@users.noreply.github.com> --- src/lib/watch-processor.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/watch-processor.ts b/src/lib/watch-processor.ts index f7c2af770..1aaa4c29a 100644 --- a/src/lib/watch-processor.ts +++ b/src/lib/watch-processor.ts @@ -95,8 +95,8 @@ async function runBinding(binding: Binding, capabilityNamespaces: string[]) { watcher.events.on(WatchEvent.CONNECT, url => logEvent(WatchEvent.CONNECT, url)); watcher.events.on(WatchEvent.DATA_ERROR, err => logEvent(WatchEvent.DATA_ERROR, err.message)); - watcher.events.on(WatchEvent.RECONNECT, (err, retryCount) => - logEvent(WatchEvent.RECONNECT, err ? `Reconnecting after ${retryCount} attempts` : ""), + watcher.events.on(WatchEvent.RECONNECT, retryCount => + logEvent(WatchEvent.RECONNECT, `Reconnecting after ${retryCount} attempt${retryCount === 1 ? "" : "s"}`), ); watcher.events.on(WatchEvent.RECONNECT_PENDING, () => logEvent(WatchEvent.RECONNECT_PENDING)); watcher.events.on(WatchEvent.GIVE_UP, err => logEvent(WatchEvent.GIVE_UP, err.message));