Skip to content
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

Fix visibility timeout errors (#4812) #4831

Merged
merged 2 commits into from
Aug 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ private ReceiveMessageRequest createReceiveMessageRequest() {
private List<DeleteMessageBatchRequestEntry> processS3EventNotificationRecords(final Collection<ParsedMessage> s3EventNotificationRecords) {
final List<DeleteMessageBatchRequestEntry> deleteMessageBatchRequestEntryCollection = new ArrayList<>();
final List<ParsedMessage> parsedMessagesToRead = new ArrayList<>();
final Map<ParsedMessage, AcknowledgementSet> messageAcknowledgementSetMap = new HashMap<>();
final Map<ParsedMessage, List<DeleteMessageBatchRequestEntry>> messageWaitingForAcknowledgementsMap = new HashMap<>();

for (ParsedMessage parsedMessage : s3EventNotificationRecords) {
if (parsedMessage.isFailedParsing()) {
Expand Down Expand Up @@ -224,7 +226,7 @@ && isEventBridgeEventTypeCreated(parsedMessage)) {
}

LOG.info("Received {} messages from SQS. Processing {} messages.", s3EventNotificationRecords.size(), parsedMessagesToRead.size());

for (ParsedMessage parsedMessage : parsedMessagesToRead) {
List<DeleteMessageBatchRequestEntry> waitingForAcknowledgements = new ArrayList<>();
AcknowledgementSet acknowledgementSet = null;
Expand Down Expand Up @@ -262,7 +264,19 @@ && isEventBridgeEventTypeCreated(parsedMessage)) {
},
Duration.ofSeconds(progressCheckInterval));
}
messageAcknowledgementSetMap.put(parsedMessage, acknowledgementSet);
messageWaitingForAcknowledgementsMap.put(parsedMessage, waitingForAcknowledgements);
}
}

if (endToEndAcknowledgementsEnabled) {
LOG.info("Created acknowledgement sets for {} messages.", parsedMessagesToRead.size());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this a debug level log. Otherwise, we'll have too many logs generated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I will update the log level to debug.

}

// Use a separate loop for processing the S3 objects
for (ParsedMessage parsedMessage : parsedMessagesToRead) {
final AcknowledgementSet acknowledgementSet = messageAcknowledgementSetMap.get(parsedMessage);
final List<DeleteMessageBatchRequestEntry> waitingForAcknowledgements = messageWaitingForAcknowledgementsMap.get(parsedMessage);
final S3ObjectReference s3ObjectReference = populateS3Reference(parsedMessage.getBucketName(), parsedMessage.getObjectKey());
final Optional<DeleteMessageBatchRequestEntry> deleteMessageBatchRequestEntry = processS3Object(parsedMessage, s3ObjectReference, acknowledgementSet);
if (endToEndAcknowledgementsEnabled) {
Expand All @@ -271,7 +285,7 @@ && isEventBridgeEventTypeCreated(parsedMessage)) {
} else {
deleteMessageBatchRequestEntry.ifPresent(deleteMessageBatchRequestEntryCollection::add);
}
}
}

return deleteMessageBatchRequestEntryCollection;
}
Expand Down
Loading