-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Describe the problem
Today in core-based SDKs, we set workflow completion immediately upon workflow return and discard anything else that may happen on the same task. In Go/Java, we let the coroutines all complete even if they make commands and then set workflow completion after that. We should do the same in core-based SDKs.
In order to do this in a backwards-compatible way, we will need to leverage SDK flags. And in order to not have to put this flag on every workflow henceforth, SDKs will need to determine whether there are post-completion commands after the workflow returns.
An approach (EDIT: this is what was decided) (EDIT2: we decided not to go with this):
SDKs can choose one of the two options:
Option 1:
- Change SDKs to, upon workflow function return, store the result and note the commands currently in buffer
- Upon workflow completion and all coroutines settled:
- If replaying and SDK flag not set, add the workflow completion command and discard any that came after
- If not replaying and there are other commands before workflow completion, set the SDK flag and set those commands before setting workflow completion
Option 2:
- When workflow complete command is in activation completion command set, do one of these three:
- If SDK flag not set and replaying, do same thing as today (don't set flag, allow commands after completion to be removed)
- If there are no non-query-complete commands after completion, do same thing (don't set flag)
- Set the SDK flag and move the completion to the end (i.e. before any trailing query completions)
Another approach (EDIT: this was decided against) (EDIT 2: we decided to do this)
- Send all post-complete commands to core instead of truncating like we do today
- Let core decide to move workflow completion to the end + set flag or truncate post-completion commands if replaying and flag wasn't set
Describe the solution you'd like
Decision
We're going with the first approach above. And core doesn't need to do anything, it already allows flags.
Per-SDK Tickets
- Go - N/A
- Java - N/A
- Core - Honor all non-terminal commands sdk-core#778
- TypeScript - [Feature Request] Do not set workflow completion until after all coroutines have settled in the task sdk-typescript#1421
- Python - [Feature Request] Do not set workflow completion until after all coroutines have settled in the task sdk-python#528
- .NET - [Feature Request] Do not set workflow completion until after all coroutines have settled in the task sdk-dotnet#249
- .NET II - Handle multiple completion commands sdk-dotnet#305
- PHP - N/A
- Temporal CLI - N/A
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request