Skip to content

Commit

Permalink
Update sqs-partial-batch-failure.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sharifhh authored Apr 19, 2024
1 parent e463705 commit d7c03f2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions website/docs/middlewares/sqs-partial-batch-failure.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ import middy from '@middy/core'
import sqsBatch from '@middy/sqs-partial-batch-failure'

const lambdaHandler = (event, context) => {
const promises = [];
const statusPromises = [];
for (const [idx, record] of Object.entries(Records)) {
try {
/* Custom message processing logic */
promises.push(Promise.resolve());
statusPromises.push(Promise.resolve());
} catch (error) {
promises.push(Promise.reject(error));
statusPromises.push(Promise.reject(error));
}
}
return Promise.allSettled(recordPromises)
return Promise.allSettled(statusPromises)
}

export const handler = middy().use(sqsBatch()).handler(lambdaHandler)
Expand Down

0 comments on commit d7c03f2

Please sign in to comment.