-
Notifications
You must be signed in to change notification settings - Fork 120
Loop through records from SQS #4603
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
Conversation
| case Tiff => Left("Image file type is not supported. File type: Tiff") | ||
| } | ||
| } | ||
| object EmbedderMessage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
1e90bf8 to
89cb191
Compare
| @@ -0,0 +1,43 @@ | |||
| #!/bin/bash | |||
| set -euo pipefail | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think it's worth a note (comment?) about what this does! sends a batch containing the same message 10 times?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah fair enough - I added something in the PR description so I'll add that as a comment
joelochlann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
|
Seen on metadata-editor (merged by @ellenmuller 8 minutes and 54 seconds ago) Please check your changes! |
|
Seen on auth, usage, image-loader, cropper, collections, kahuna (merged by @ellenmuller 8 minutes and 59 seconds ago) Please check your changes! |
|
Seen on thrall, leases, media-api (merged by @ellenmuller 9 minutes and 5 seconds ago) Please check your changes! |
What does this change?
This PR actions some comments from my previous PR, #4593, most notably this one #4593 (comment).
We now loop through the records sent from SQS, and if there's an error they get captured as
BatchItemFailuresand returned at the end of the handler. This is to avoid an error happening halfway through the loop, and the whole batch ending on the DLQ. This is recommended by AWS here https://docs.aws.amazon.com/prescriptive-guidance/latest/lambda-event-filtering-partial-batch-responses-for-sqs/best-practices-partial-batch-responses.html.I've also added a script to send a batch of records and we can see that the handler correctly loops through them. (Do note that the write to the S3 Vector Store will fail because we're trying to write duplicate keys! This script is just useful for testing the loop behaviour and perhaps may be useful in the future if we start skipping images already embedded)
I also added a case class
EmbedderMessagefor themessageBodywe send to SQS from image-loader for extra type safety.