-
Notifications
You must be signed in to change notification settings - Fork 0
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
moving publish action into a lambda #296
Conversation
@@ -320,7 +326,7 @@ public GrantAdvert publishAdvert(UUID advertId) { | |||
|
|||
if (Boolean.FALSE.equals(contentfulAdvert.isPublished())) { | |||
final CMAEntry publishedAdvert = contentfulManagementClient.entries().publish(contentfulAdvert); | |||
openSearchService.indexEntry(publishedAdvert); | |||
sendMessageToQueue(new SendAdvertToSqsDto(publishedAdvert.getId(), "ADD")); |
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.
I think this function should be the very last thing this endpoint does - as if we fail to save to the DB for whatever reason upon a scheduled publishing, this endpoint will be hit multiple times due to the publish advert lambdas retry behaviour, which will result in us sending multiple messages to our new publish elastic lambda.
I think the end state would then be duplicate adverts showing up in elastic in this edge case, which would require manually cleaning up
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.
Jamie and I tested elastic last week, it's idempotent so not sure there would be duplicates but the lambda on the other end of this exchange might end up with errors from contentful so good shout nonetheless.
@@ -333,7 +339,7 @@ public void unpublishAdvert(UUID advertId) { | |||
|
|||
if (Boolean.TRUE.equals(contentfulAdvert.isPublished())) { | |||
final CMAEntry unpublishedAd = contentfulManagementClient.entries().unPublish(contentfulAdvert); | |||
openSearchService.removeIndexEntry(unpublishedAd); | |||
sendMessageToQueue(new SendAdvertToSqsDto(unpublishedAd.getId(), "REMOVE")); |
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.
same as above
Description
moved the request to pblish to open search out of our application and into am SQS queue and a lambda.
Ticket # and link
Summary of the changes and the related issue. List any dependencies that are required for this change:
Type of change
Please check the relevant options.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes:
Unit Test
Integration Test (if applicable)
End-to-End Test (if applicable)
Screenshots (if appropriate):
Please attach screenshots of the change if it is a UI change:
Checklist: