Skip to content

Conversation

@Quinn-With-Two-Ns
Copy link
Contributor

Add CancellationType to nexus cancellation sample

Copy link

@prasek prasek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall lgtm and dropped a suggestion

// scope
scope.cancel();
// Optionally, wait for all nexus operations to complete
// Optionally, wait for all nexus operations to receive a cancellation request before
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs make it sound like we should recommend waiting to ensure the cancel is delivered to the handler, if so would clarify the behavior here: if you wait/don't wait for Nexus ops to complete in caller workflow before exiting the caller workflow, then cancel will/may be delivered if using WAIT_REQUESTED

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree we should recommend waiting. Just to be clear the caller isn't waiting for the nexus op to complete if they are using WAIT_REQUESTED they are just waiting for the cancel to be requested . There can be a gap between when cancel is requested and when the nexus op actually completes, I simulate that in this sample by sleeping after the cancel request.

@Quinn-With-Two-Ns Quinn-With-Two-Ns marked this pull request as ready for review June 24, 2025 23:51
@Quinn-With-Two-Ns Quinn-With-Two-Ns merged commit daaf8c4 into temporalio:main Jun 25, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants