4
4
from dataclasses import dataclass
5
5
from typing import Any , Callable , Protocol , TypeAlias
6
6
7
- from dispatch .coroutine import Gather
7
+ from dispatch .coroutine import All
8
8
from dispatch .error import IncompatibleStateError
9
9
from dispatch .experimental .durable .function import DurableCoroutine , DurableGenerator
10
10
from dispatch .proto import Call , Error , Input , Output
@@ -78,8 +78,8 @@ def value(self) -> Any:
78
78
79
79
80
80
@dataclass (slots = True )
81
- class GatherFuture :
82
- """A future result of a dispatch.coroutine.gather () operation."""
81
+ class AllFuture :
82
+ """A future result of a dispatch.coroutine.all () operation."""
83
83
84
84
order : list [CoroutineID ]
85
85
waiting : set [CoroutineID ]
@@ -386,11 +386,9 @@ def _run(self, input: Input) -> Output:
386
386
state .prev_callers .append (coroutine )
387
387
state .outstanding_calls += 1
388
388
389
- case Gather ():
390
- gather = coroutine_yield
391
-
389
+ case All ():
392
390
children = []
393
- for awaitable in gather .awaitables :
391
+ for awaitable in coroutine_yield .awaitables :
394
392
g = awaitable .__await__ ()
395
393
if not isinstance (g , DurableGenerator ):
396
394
raise ValueError (
@@ -408,7 +406,7 @@ def _run(self, input: Input) -> Output:
408
406
state .ready = children + state .ready
409
407
410
408
child_ids = [child .id for child in children ]
411
- coroutine .result = GatherFuture (
409
+ coroutine .result = AllFuture (
412
410
order = child_ids , waiting = set (child_ids ), results = {}
413
411
)
414
412
state .suspended [coroutine .id ] = coroutine
0 commit comments