temporal icon indicating copy to clipboard operation
temporal copied to clipboard

Support `WorkflowIdConflictPolicy` for child workflow

Open stephanos opened this issue 1 year ago • 7 comments

Is your feature request related to a problem? Please describe.

WorkflowIdReusePolicy's Terminate-if-Running is being deprecated and replaced with WorkflowIdConflictPolicy's Terminate-Existing.

To complete this effort, support for child workflows is needed.

Describe the solution you'd like TBD

Describe alternatives you've considered TBD

Additional context

This is blocking https://github.com/temporalio/features/issues/558

stephanos avatar Nov 12 '24 16:11 stephanos

bump

john-behm-bertelsmann avatar Apr 30 '25 09:04 john-behm-bertelsmann

Just ran in to this limitation - not great. This, combined with the fact that "external workflow handles" don't allow you to wait on the result of another workflow, is causing quite a friction for my usecase right now. Going to have to re-think my workflow design because of this now.

lukeramsden avatar May 26 '25 17:05 lukeramsden

@lukeramsden You can wait for external workflow completion using an activity, that's what we did. You can rely on retries to keep activity running indefinitely or implement more complex logic involving heartbeats.

import { cancelled } from '@temporalio/activity';

async function waitForExternalWorkflowCompletion(workflowId: string): Promise<void> {
	await Promise.race([
		workflowClient.getHandle(workflowId).result(),
		cancelled(),
	]);
}

If you implement long-polling based on retry behavior, just make sure the promise completes when the activity is cancelled. Otherwise, the activity slots won't be freed.

mpontus avatar May 27 '25 18:05 mpontus

Ran into a use case today

prakharb10 avatar Jun 10 '25 21:06 prakharb10

We also have a use-case for this, and getting it through local activity and signal is ugly.

madhav2302 avatar Aug 11 '25 16:08 madhav2302

See comment at https://github.com/temporalio/features/issues/558#issuecomment-3176176866 on why use-existing may not make sense from a technical perspective.

cretz avatar Aug 11 '25 17:08 cretz