We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 219599f commit 210a733Copy full SHA for 210a733
1 file changed
core/workflow/callable/call.go
@@ -27,6 +27,7 @@ package callable
27
import (
28
"fmt"
29
"strconv"
30
+ "sync"
31
texttemplate "text/template"
32
"time"
33
@@ -102,13 +103,20 @@ func (s Calls) StartAll() {
102
103
}
104
105
func (s Calls) AwaitAll() map[*Call]error {
106
+ // Since each Await call blocks, we call it in parallel and then collect
107
errors := make(map[*Call]error)
108
+ wg := &sync.WaitGroup{}
109
+ wg.Add(len(s))
110
for _, v := range s {
- err := v.Await()
- if err != nil {
- errors[v] = err
- }
111
+ go func(v *Call) {
112
+ defer wg.Done()
113
+ err := v.Await()
114
+ if err != nil {
115
+ errors[v] = err
116
+ }
117
+ }(v)
118
119
+ wg.Wait()
120
return errors
121
122
0 commit comments