From 157146a550981974f297752b8aae990cb9007650 Mon Sep 17 00:00:00 2001 From: Sercan Turkmen Date: Fri, 24 Jan 2025 04:55:50 +0900 Subject: [PATCH] fix: compare errors with string to avoid log spew in jetstream sensor (#3441) Signed-off-by: Sercan Turkmen --- USERS.md | 1 + pkg/eventbus/jetstream/sensor/trigger_conn.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/USERS.md b/USERS.md index 144db90884..e7f6768184 100644 --- a/USERS.md +++ b/USERS.md @@ -58,3 +58,4 @@ Organizations below are **officially** using Argo Events. Please send a PR with 1. [WooliesX](https://wooliesx.com.au/) 1. [Woolworths Group](https://www.woolworthsgroup.com.au/) 1. [Zillow Group](https://www.zillow.com) +1. [AlpacaTech](https://www.alpaca-tech.ai) diff --git a/pkg/eventbus/jetstream/sensor/trigger_conn.go b/pkg/eventbus/jetstream/sensor/trigger_conn.go index d38ed5123f..3467513818 100644 --- a/pkg/eventbus/jetstream/sensor/trigger_conn.go +++ b/pkg/eventbus/jetstream/sensor/trigger_conn.go @@ -197,7 +197,7 @@ func (conn *JetstreamTriggerConn) pullSubscribe( // call Fetch with timeout msgs, fetchErr := subscription.Fetch(1, nats.MaxWait(time.Second*1)) if fetchErr != nil && !errors.Is(fetchErr, nats.ErrTimeout) { - if previousErr != fetchErr || time.Since(previousErrTime) > 10*time.Second { + if (previousErr != nil && previousErr.Error() != fetchErr.Error()) || time.Since(previousErrTime) > 10*time.Second { // avoid log spew - only log error every 10 seconds conn.Logger.Errorf("failed to fetch messages for subscription %+v, %v, previousErr=%v, previousErrTime=%v", subscription, fetchErr, previousErr, previousErrTime) }