Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(custom-resource-handlers): don't recursively process s3 bucket ob…
…jects I recently had the mispleasure of trying to empty a bucket with ~600000 objects using CDK's `autoDeleteObjects` feature. What I observed was that each lambda invocation would get through a few tens of thousands of objects in relatively good time (a few minutes), then the lambda would grind to a halt doing very little until it reached its 15 minute timeout. This process then repeats with subsequent invocations of the lambda. I suspect but have not proven that the low memory allocated to the lambda (the default 128mb) plus this recursion is to blame. There is no need to recurse, and doing so will put pressure on the stack, the heap, and (because this is an async function) the event loop. I see nothing else that could result in such an outcome here.
- Loading branch information