Description
"Batch" of SQS messages above 10 count causes problems during cleanup since boto3.client('sqs').delete_message_batch is limited to 10. There is a hard limit of 10 when utilizing delete_message_batch that is not properly documented in boto3 (whereas other batch methods do show 10). There is also no documentation reflecting a limit of 10 when implementing the sqs batch processor provided in this project. Infact the SQS documentation itself does not mention a limit - https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_DeleteMessageBatch.html but the return from this function when attempting to delete more than 10 messages is inline with errors for other messages when the records are greater than 10 (and those are properly documented).
I don't believe this is a documentation related issue - however - and this was simply an oversight where > 10 was expected to "just work".
What were you trying to accomplish?
I typically limit between 10-20 messages when performing longer running record processing functions and set my timeout for my lambda appropriately. I've toyed with making a toggle to flush deletions one by one (by only processing one record as a list at a time) for these sorts of tasks and think that is something that may be appropriate some day.
I also have (had) a limit of 1000 or 30 seconds for tracking data (route changes in frontend app) that is aggregated and spooled to AWS timestream. Processing time for 1000 records is typically less than 4 seconds... however I wasn't properly deleting these messages and had accidentally squashed the exception that would have told me there were some limits.
Expected Behavior
delete_message_batch isn't documented for having a 10 record id limit.. Ideally it would have deleted more than 10 at a time.
Current Behavior
delete_message_batch properly causes an exception to come back if there are more than 10.
Possible Solution
I've implemented a patch to allow arbitrary amounts of records to be spooled to delete_message_batch.
Currently I limit processing to 10 records at a time (while also allowing for more than 10) as a pattern (when processing batches can be done this way without causing an upstream issue). It IS nice that later batches can fail while earlier successful ones are properly cleaned.
May need to rethink documentation and examples to properly show supporting more than 10 records per event.
Steps to Reproduce (for bugs)
N/A
Environment
- aws-lambda-powertools==1.20.2
- python==3.8