Closed amh4r closed 2 months ago
Add parallel steps using a new group.Parallel function. The new group package lives in an experimental directory, where it will remain until we feel it's stable.
group.Parallel
group
experimental
func MyFn(ctx context.Context, input inngestgo.Input[any]) (any, error) { results := group.Parallel( ctx, func(ctx context.Context) (any, error) { return step.Run(ctx, "1a", func(ctx context.Context) (string, error) { return "1a output", nil }) }, func(ctx context.Context) (any, error) { return step.Run(ctx, "1b", func(ctx context.Context) (string, error) { return "1b output", nil }) }, ) out := make([]string, len(results)) for i, r := range results { if r.Error != nil { return nil, r.Error } out[i] = r.Value.(string) } return out, nil }
Description
Add parallel steps using a new
group.Parallel
function. The newgroup
package lives in anexperimental
directory, where it will remain until we feel it's stable.