bbc / sqs-consumer

Build Amazon Simple Queue Service (SQS) based applications without the boilerplate
https://bbc.github.io/sqs-consumer/
Other
1.74k stars 333 forks source link

[Bugfix] Implement heartbeat fix #303

Closed hayes-crowley closed 2 years ago

hayes-crowley commented 2 years ago

Monday task: https://patternarch.monday.com/boards/2433534228/pulses/2483876310

Summary

Forked sqs-consumer and implemented a PR that has been open for some time (https://github.com/bbc/sqs-consumer/pull/280)

Essentially, the issue is that sometimes the heartbeatInterval will fire its changeVisibilityTimeout request after a message has been deleted (the receiptHandleID is invalid). This returns an error from SQS:

"Receipt Handle is invalid. Reason: Message does not exist or is not available for visibility timeout change."

that was not being handled due to not returning an await statement within an async function (see diff). We should no longer be getting unhandled exceptions in the logs.

Testing plan

  1. Set heartbeat interval and visbilityTimeout to a very low value in ct_node (e.g., 1 and 5 respectively)
  2. Run daylight analysis
  3. Confirm that change visibility error is being logged instead of "unhandled exceptions"
github-actions[bot] commented 1 year ago

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.