Skip to content

Commit

Permalink
Do 5 retries for resource list updates
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Widdis <[email protected]>
  • Loading branch information
dbwiddis committed Oct 2, 2024
1 parent c26fb39 commit 931fa37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ public void addResourceToStateIndex(
getAndUpdateResourceInStateDocumentWithRetries(
workflowId,
newResource,
3,
5,
ActionListener.runBefore(listener, context::restore)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ public void testAddResourceToStateIndexWithRetries() throws IOException {
verify(retryListener, times(1)).onResponse(responseCaptor.capture());
assertEquals("this_id", responseCaptor.getValue().getContent().get(WorkflowResources.CONNECTOR_ID));

// test failure on 4th after 3 retries even if 5th would have been success
// test failure on 6th after 5 retries even if 7th would have been success
@SuppressWarnings("unchecked")
ActionListener<WorkflowData> threeRetryListener = mock(ActionListener.class);
doAnswer(invocation -> {
Expand All @@ -719,6 +719,14 @@ public void testAddResourceToStateIndexWithRetries() throws IOException {
ActionListener<UpdateResponse> responseListener = invocation.getArgument(1);
responseListener.onFailure(conflictException);
return null;
}).doAnswer(invocation -> {
ActionListener<UpdateResponse> responseListener = invocation.getArgument(1);
responseListener.onFailure(conflictException);
return null;
}).doAnswer(invocation -> {
ActionListener<UpdateResponse> responseListener = invocation.getArgument(1);
responseListener.onFailure(conflictException);
return null;
}).doAnswer(invocation -> {
// we'll never get here
ActionListener<UpdateResponse> responseListener = invocation.getArgument(1);
Expand Down

0 comments on commit 931fa37

Please sign in to comment.