workflow.Go OR Futures?

Hi!
I’m not sure if I’m doing it right. I have ~10 activities that should (can) be executed in parallel, and I need to wait for all their result in a workflow.
Should I

  1. use workflow.Go for each activity?
    Or
  2. will it be enough to just call Future.Get on each activity result after I’ve started all the activities?
    i.e.
    future1 := workflow.ExecuteActivity(…)
    future2 := workflow.ExecuteActivity(…)
    future3 := workflow.ExecuteActivity(…)
    //…
    future1.Get()
    future2.Get()
    future3.Get()

will it have the same effect?

The problem that I’m observing with (2) is that workflow task regularly fails to schedule just before this code, so I’m assuming that this could be a problem.

Thanks

You can add all the futures to a workflow.Selector and the first future completed will call its callback upon Select. You can do this however many times necessary (this is similar to a Go select).

Yes, and I don’t mind waiting sequentially for the futures.

But my question is should I use workflow.Go on these activities? Is their start inherently parallel, event without workflow.Go ?

You don’t need to use workflow.Go. You can start them all and then handle all of their futures together with a selector or however.

I guess that your workflow task fails because the aggregated input payloads for all the parallel activities exceed 4 MB gRPC request limit size.

yeah, we stumbled upon that too, fixed, thanks!