Skip to content
Closed
Changes from all commits
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 @@ -95,12 +95,24 @@ public void acknowledge(List<String> acknowledgementIds) {
.addAllAckIds(splittedAckIds.f0)
.build();

stub.withDeadlineAfter(60, SECONDS).acknowledge(acknowledgeRequest);

acknowledgeWithRetries(acknowledgeRequest, retries);
splittedAckIds = splitAckIds(splittedAckIds.f1);
}
}

private void acknowledgeWithRetries(AcknowledgeRequest acknowledgeRequest, int retriesRemaining) {
try {
stub.withDeadlineAfter(timeout.toMillis(), TimeUnit.MILLISECONDS).acknowledge(acknowledgeRequest);
} catch (StatusRuntimeException e) {
if (retriesRemaining > 0) {
acknowledgeWithRetries(acknowledgeRequest, retriesRemaining - 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably don't want to have recursion in the retry logic. Can we replace it with a for loop instead?

return;
}

throw e;
}
}

/* maxPayload is the maximum number of bytes to devote to actual ids in
* acknowledgement or modifyAckDeadline requests. A serialized
* AcknowledgeRequest grpc call has a small constant overhead, plus the size of the
Expand Down