Skip to content

Commit 7eb62a5

Browse files
robrichardyaacovCR
authored andcommitted
add isCompletedIterator to AsyncPayloadRecord to track completed iterators
# Conflicts: # spec/Section 6 -- Execution.md
1 parent bc9c522 commit 7eb62a5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

spec/Section 6 -- Execution.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,13 +386,13 @@ YieldSubsequentPayloads(subsequentPayloads):
386386
- Let {record} be the first item in {subsequentPayloads} with a completed
387387
{dataExecution}.
388388
- Remove {record} from {subsequentPayloads}.
389-
- Let {payload} be the completed result returned by {dataExecution}.
390-
- If {payload} is {null}:
389+
- If {isCompletedIterator} on {record} is {true}:
391390
- If {subsequentPayloads} is empty:
392391
- Yield a map containing a field `hasNext` with the value {false}.
393392
- Return.
394393
- If {subsequentPayloads} is not empty:
395394
- Continue to the next record in {subsequentPayloads}.
395+
- Let {payload} be the completed result returned by {dataExecution}.
396396
- If {record} is not the final element in {subsequentPayloads}:
397397
- Add an entry to {payload} named `hasNext` with the value {true}.
398398
- If {record} is the final element in {subsequentPayloads}:
@@ -681,6 +681,8 @@ All Async Payload Records are structures containing:
681681
- {path}: a list of field names and indices from root to the location of the
682682
corresponding `@defer` or `@stream` directive.
683683
- {iterator}: The underlying iterator if created from a `@stream` directive.
684+
- {isCompletedIterator}: a boolean indicating the payload record was generated
685+
from an iterator that has completed.
684686
- {errors}: a list of field errors encountered during execution.
685687
- {dataExecution}: A result that can notify when the corresponding execution has
686688
completed.
@@ -863,6 +865,7 @@ variableValues, subsequentPayloads):
863865
- Let {dataExecution} be the asynchronous future value of:
864866
- Wait for the next item from {iterator}.
865867
- If an item is not retrieved because {iterator} has completed:
868+
- Set {isCompletedIterator} to {true} on {streamRecord}.
866869
- Return {null}.
867870
- Let {payload} be an unordered map.
868871
- Let {item} be the item retrieved from {iterator}.

0 commit comments

Comments
 (0)