Will workflow.Go 's resource be reclaimed after Flow End(cancel/term)

Here is the original code:

I changed as bellow: (add signal watch to repeat activity execution as I control )

	if b.Activity != nil {
		workflow.Go(ctx, func(ctx workflow.Context) {
			for {
				err := b.Activity.execute(ctx, bindings)
				if err != nil {
					logger.Error("activity error", err)
				repCh := workflow.GetSignalChannel(ctx, RepeatSignalName)
				var holder string
				repCh.Receive(ctx, &holder)


I’m not sure the does the for loop here will cause any problem?

Yes, all workflow resources including goroutines started with workflow.Go are going to be reclaimed.

1 Like

Thank you maxim.