Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Quinn-With-Two-Ns committed Dec 30, 2024
1 parent 97054ec commit fd755e3
Showing 1 changed file with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -553,28 +553,7 @@ public void completeWorkflowTask(
|| request.getForceCreateNewWorkflowTask())) {
scheduleWorkflowTask(ctx);
}
if (completed) {
updates.forEach(
(k, updateStateMachine) -> {
if (!(updateStateMachine.getState() == StateMachines.State.COMPLETED
|| updateStateMachine.getState() == StateMachines.State.FAILED)) {
updateStateMachine.action(
Action.COMPLETE,
ctx,
Message.newBuilder()
.setBody(
Any.pack(
Response.newBuilder()
.setOutcome(
Outcome.newBuilder()
.setFailure(FAILED_UPDATE_ON_WF_COMPLETION)
.build())
.build()))
.build(),
workflowTaskCompletedId);
}
});
}

workflowTaskStateMachine.getData().bufferedEvents.clear();
Map<String, ConsistentQuery> queries = data.consistentQueryRequests;
Map<String, WorkflowQueryResult> queryResultsMap = request.getQueryResultsMap();
Expand Down Expand Up @@ -1705,6 +1684,27 @@ private void processWorkflowCompletionCallbacks(RequestContext ctx) {
return;
}

updates.forEach(
(k, updateStateMachine) -> {
if (!(updateStateMachine.getState() == StateMachines.State.COMPLETED
|| updateStateMachine.getState() == StateMachines.State.FAILED)) {
updateStateMachine.action(
Action.COMPLETE,
ctx,
Message.newBuilder()
.setBody(
Any.pack(
Response.newBuilder()
.setOutcome(
Outcome.newBuilder()
.setFailure(FAILED_UPDATE_ON_WF_COMPLETION)
.build())
.build()))
.build(),
completionEvent.get().getEventId());
}
});

for (Callback cb : startRequest.getCompletionCallbacksList()) {
if (!cb.hasNexus()) {
// test server only supports nexus callbacks currently
Expand Down

0 comments on commit fd755e3

Please sign in to comment.