You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`selector.Select(ctx)` is the primary mechanism which blocks on and executes `Future` work.
81
-
It is intentionally flexible; you may call it conditionally or multiple times:
80
+
Calling `ExecuteActivity` by itself doesn't result in actual Activity execution. It results in a command that gets batched with others when there's a yield point in the Workflow definition. Your `Futures` won't run until you call `selector.Select(ctx)`. So no calls to `ExecuteActivity` should result in commands being sent to the server until `selector.Select` is called.
81
+
82
+
A call to `selector.Select(ctx)` doesn't actually execute a `Future`, but it _requests_ execution for a `Future`. So this is a point where the SDK will communicate the command to execute the Activity to the server.
82
83
83
84
```go
84
-
// API Example: blocking conditionally
85
+
// API Example: blocking conditionally
85
86
if somecondition != nil {
86
-
selector.Select(ctx)
87
+
selector.Select(ctx)
87
88
}
88
89
89
-
// API Example: popping off all remaining Futures
90
+
// API Example: popping off all remaining Futures
90
91
fori:=0; i < len(someArray); i++ {
91
-
selector.Select(ctx) // this will wait for one branch
92
-
// you can interrupt execution here
93
-
}
92
+
selector.Select(ctx) // this will wait for one branch
93
+
// you can interrupt execution here
94
+
}
94
95
```
95
96
96
97
A Future matches only once per Selector instance even if Select is called multiple times.
0 commit comments