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 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