Skip to content

Commit

Permalink
fix: compare errors with string to avoid log spew in jetstream sensor (
Browse files Browse the repository at this point in the history
…#3441)

Signed-off-by: Sercan Turkmen <[email protected]>
  • Loading branch information
sercant authored Jan 23, 2025
1 parent 76df5c8 commit 157146a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions USERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion pkg/eventbus/jetstream/sensor/trigger_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 157146a

Please sign in to comment.