Skip to content

Commit 1c1f9bb

Browse files
committed
Edits
1 parent 3ad0b0e commit 1c1f9bb

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

temporal-sdk/src/main/java/io/temporal/internal/replay/ReplayWorkflowTaskHandler.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,16 @@ private Result handleWorkflowTaskWithQuery(
119119
Result result;
120120

121121
if (directQuery) {
122-
// Direct query happens when there is no reason (events) to produce a real persisted
123-
// workflow task.
124-
// But Server needs to notify the workflow about the query and get back the query result.
125-
// Server creates a fake non-persisted a PollWorkflowTaskResponse with just the query.
126-
// This WFT has no new events in the history to process
127-
// and the worker response on such a WFT can't contain any new commands either.
122+
// A direct query is when the server needs to notify the workflow about queries (and get back the query
123+
// results), but there are no new events in history. In this situation the server creates a
124+
// PollWorkflowTaskResponse (i.e. a WFT) with the queries but without new events in the history. The worker
125+
// response to such a WFT may not contain any new commands.
128126
QueryResult queryResult =
129127
workflowRunTaskHandler.handleDirectQueryWorkflowTask(workflowTask, historyIterator);
130128
finalCommand = queryResult.isWorkflowMethodCompleted();
131129
result = createDirectQueryResult(workflowTask, queryResult, null);
132130
} else {
133-
// main code path, handle workflow task that can have an embedded query
131+
// Main code path; handle workflow task (with events, and perhaps also queries).
134132
WorkflowTaskResult wftResult =
135133
workflowRunTaskHandler.handleWorkflowTask(workflowTask, historyIterator);
136134
finalCommand = wftResult.isFinalCommand();

0 commit comments

Comments
 (0)