Skip to content

Commit

Permalink
chore: fix message count bug
Browse files Browse the repository at this point in the history
  • Loading branch information
martdo02 committed Sep 11, 2024
1 parent 0362878 commit ddf76c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/aws/stepDefinitions/sqs.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ async function waitUntilQueueHasCount (queueName, messageCount, timeout) {
let queueAttributes
do {
queueAttributes = await attributesOfQueue(queueName)
if (queueAttributes.ApproximateNumberOfMessages === '0') {
if (queueAttributes.ApproximateNumberOfMessages === messageCount.toString()) {
return true
}
await new Promise(resolve => setTimeout(resolve, 5000))
} while (Date.now() - startTime < timeout * 1000)
throw new Error('Queue is not empty within ' + timeout + ' seconds')
throw new Error('Queue ' + queueName + ' did not have ' + messageCount + ' messages within ' + timeout + ' seconds. Current message count: ' + queueAttributes.ApproximateNumberOfMessages)
}

MAFWhen('queue {string} is empty within {int} second(s)', async function (queueName, timeout) {
Expand Down

0 comments on commit ddf76c3

Please sign in to comment.