Skip to content

Commit

Permalink
Adjusting the message count logic when using includeUnacked (#781)
Browse files Browse the repository at this point in the history
* Removing the addition of the unack-ed message count as the message count currently included unacknowledged messages

Signed-off-by: Travis Bickford <tbickford@shutterstock.com>
  • Loading branch information
tbickford authored May 5, 2020
1 parent 1ec79ec commit 63c35dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/scalers/rabbitmq_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ func (s *rabbitMQScaler) getQueueMessages() (int, error) {
if err != nil {
return -1, err
} else {
return info.Messages + info.MessagesUnacknowledged, nil
// messages count includes count of ready and unack-ed
return info.Messages, nil
}
} else {
items, err := s.channel.QueueInspect(s.metadata.queueName)
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/rabbitmq_scaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type getQueueInfoTestData struct {

var testQueueInfoTestData = []getQueueInfoTestData{
{`{"messages": 4, "messages_unacknowledged": 1, "name": "evaluate_trials"}`, http.StatusOK, true},
{`{"messages": 0, "messages_unacknowledged": 1, "name": "evaluate_trials"}`, http.StatusOK, true},
{`{"messages": 1, "messages_unacknowledged": 1, "name": "evaluate_trials"}`, http.StatusOK, true},
{`{"messages": 1, "messages_unacknowledged": 0, "name": "evaluate_trials"}`, http.StatusOK, true},
{`{"messages": 0, "messages_unacknowledged": 0, "name": "evaluate_trials"}`, http.StatusOK, false},
{`Password is incorrect`, http.StatusUnauthorized, false},
Expand Down

0 comments on commit 63c35dd

Please sign in to comment.