Let’s say I am writing a helper function to use across workflows, and the helper function calls a couple of activities. Some parent workflows might loop through a medium-sized array (e.g. 100-300 items) and call the helper function on every iteration. I think I have three options to work with:
- The helper function uses
proxyActivities
to get the activity functions it needs. This provides nice encapsulation: the parent workflow doesn’t have to know or care what activities the helper uses. - The helper function expects the parent workflow to run
proxyActivities
for the two that it requires, then pass those functions in as arguments. This would mitigate any problems with the helper callingproxyActivities
on every loop iteration. - Turn the helper function into a child workflow. Then it has no choice but to call
proxyActivities
itself.
Assuming I have no other reason to think the helper needs to be a child workflow, option (1) is definitely the simplest. But I’m wondering if there are any problems with repeating proxyActivities
calls in this way. So I’m wondering what you would recommend.
I’m using the TypeScript SDK, in case that affects the answer.