Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(batch): delete >10 messages in legacy sqs processor #818

Conversation

whardier
Copy link
Contributor

@whardier whardier commented Nov 12, 2021

No related issue

Description of changes:

SQS/Batch - SImple addition to process chunks of records that need removed in 10's. Counterintuitive and migrating this behaviour to the batch processor scope itself would be too disruptive.

Checklist

Breaking change checklist

No breaking changes. Introduces no new exception handling and would fix batch handling of more than 10 records.

No RFC:

  • Migration process documented
  • Implement warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…e than 10 messages were processed that would need deleted.
@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 12, 2021
@whardier whardier changed the title fix(utilities/batch/sqs): Delete to messages at a time. Before this problems would occur if more than 10 messages were processed that would need deleted. fix(utilities/batch/sqs): Delete 10 messages at a time. Before this problems would occur if more than 10 messages were processed that would need deleted. Nov 12, 2021
@whardier
Copy link
Contributor Author

whardier commented Nov 12, 2021

Working on updating the tests now.. overlooked it.

@pull-request-size pull-request-size bot removed the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 12, 2021
@boring-cyborg boring-cyborg bot added the tests label Nov 12, 2021
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 12, 2021
@codecov-commenter
Copy link

codecov-commenter commented Nov 13, 2021

Codecov Report

Merging #818 (9333e14) into develop (6869155) will decrease coverage by 0.05%.
The diff coverage is 86.36%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #818      +/-   ##
===========================================
- Coverage    99.96%   99.90%   -0.06%     
===========================================
  Files          119      119              
  Lines         5347     5364      +17     
  Branches       610      612       +2     
===========================================
+ Hits          5345     5359      +14     
- Misses           0        3       +3     
  Partials         2        2              
Impacted Files Coverage Δ
aws_lambda_powertools/utilities/batch/sqs.py 96.15% <86.36%> (-3.85%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6869155...9333e14. Read the comment docs.

@heitorlessa
Copy link
Contributor

Hey @whardier could you create an issue first detailing the bug please?

For example, what configuration are you using so that your function receives more than 10 messages per invocation where this is necessary? e.g. large batch size, longer batch window?

If a single function receives a few thousand records with 50% partial failure, this has the side effect of increasing function duration and potentially timing out if one is not careful.

An issue helps us think about potential side effects like these, compromises, what information we need to provide in the docs to help other customers unfamiliar with this scenario, etc.

Thanks a lot!

@heitorlessa heitorlessa added the need-issue PRs that are missing related issues label Nov 14, 2021
@whardier
Copy link
Contributor Author

#824

@heitorlessa heitorlessa changed the title fix(utilities/batch/sqs): Delete 10 messages at a time. Before this problems would occur if more than 10 messages were processed that would need deleted. fix(batch): delete >10 successful messages in legacy sqs processor Dec 31, 2021
@heitorlessa
Copy link
Contributor

@mploski before you tackle the redis one, could you help revamp this PR so we can merge it?

Ask. Move to concurrent futures and pass the client to make it thread safe as explained in the review

Background. This is the legacy batch we keep around that we're only deleting 10 messages instead of all failed messages in a batch (could be hundreds).

@heitorlessa heitorlessa added help wanted Could use a second pair of eyes/hands and removed need-issue PRs that are missing related issues labels Jan 28, 2022
@mploski
Copy link
Contributor

mploski commented Jan 28, 2022

@mploski before you tackle the redis one, could you help revamp this PR so we can merge it?

Ask. Move to concurrent futures and pass the client to make it thread safe as explained in the review

Background. This is the legacy batch we keep around that we're only deleting 10 messages instead of all failed messages in a batch (could be hundreds).

Sure @heitorlessa! will look at this at the end of the next week.

@mploski
Copy link
Contributor

mploski commented Feb 7, 2022

@whardier @heitorlessa I will make changes on top of this PR's branch today.

@mploski
Copy link
Contributor

mploski commented Feb 7, 2022

@whardier Could you fetch latest changes from upstream into your repo clone? You're lagging behind a bit :-)

@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 8, 2022
@mploski mploski force-pushed the fix/batch-sqs-handler-delete-message-batch-needs-batched branch from 6a8fc66 to 9333e14 Compare February 8, 2022 21:28
@mploski mploski requested a review from heitorlessa February 8, 2022 21:32
@mploski
Copy link
Contributor

mploski commented Feb 8, 2022

@whardier @heitorlessa Applied suggestions, please review.

@whardier
Copy link
Contributor Author

whardier commented Feb 8, 2022

This looks clean. I can't test it right away however. I like it.

Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome, thank you so much @mploski and also @whardier for kick starting it.

We can now make moves to release several papercuts and the mypy official support now.

Thank you!

@@ -120,23 +123,39 @@ def _prepare(self):
self.success_messages.clear()
self.fail_messages.clear()

def _clean(self):
def _clean(self) -> Optional[List]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

niiiice one! Thanks

@github-actions github-actions bot added the bug Something isn't working label Feb 9, 2022
@heitorlessa heitorlessa changed the title fix(batch): delete >10 successful messages in legacy sqs processor fix(batch): delete >10 messages in legacy sqs processor Feb 9, 2022
@heitorlessa heitorlessa merged commit 2cc1135 into aws-powertools:develop Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Could use a second pair of eyes/hands p1 size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants