From c53af44d551e4122d63d6c3e346d90b2defd05ba Mon Sep 17 00:00:00 2001 From: Antoine Laffargue Date: Wed, 2 Nov 2022 21:55:24 +0100 Subject: [PATCH 1/2] fix: keda now include the messages that should be retried in the count of pending messages used for scaling Signed-off-by: Antoine Laffargue --- pkg/scalers/nats_jetstream_scaler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/scalers/nats_jetstream_scaler.go b/pkg/scalers/nats_jetstream_scaler.go index 7903bba17b7..4d944e00604 100644 --- a/pkg/scalers/nats_jetstream_scaler.go +++ b/pkg/scalers/nats_jetstream_scaler.go @@ -195,7 +195,7 @@ func (s *natsJetStreamScaler) getMaxMsgLag() int64 { for _, consumer := range s.stream.Consumers { if consumer.Name == consumerName { - return int64(consumer.NumPending) + return int64(consumer.NumPending + consumer.NumAckPending) } } return s.stream.State.LastSequence From 9ed545ee64915a553f7681a1a4aa3977505d76de Mon Sep 17 00:00:00 2001 From: Antoine Laffargue Date: Wed, 2 Nov 2022 21:19:48 +0000 Subject: [PATCH 2/2] chore: update changelog Signed-off-by: Antoine Laffargue --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f29a8402d90..1decf86b920 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,6 +67,7 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio - **General:** Respect optional parameter inside envs for ScaledJobs ([#3568](https://github.com/kedacore/keda/issues/3568)) - **Azure Blob Scaler** Store forgotten logger ([#3811](https://github.com/kedacore/keda/issues/3811)) - **Prometheus Scaler:** Treat Inf the same as Null result ([#3644](https://github.com/kedacore/keda/issues/3644)) +- **NATS Jetstream:** Correctly count messages that should be redelivered (waiting for ack) towards keda value ([#3787](https://github.com/kedacore/keda/issues/3787)) ### Deprecations