Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not set workflow completion until after all coroutines have settled in the task #481

Open
5 of 9 tasks
cretz opened this issue May 17, 2024 · 0 comments
Open
5 of 9 tasks
Labels
enhancement New feature or request

Comments

@cretz
Copy link
Member

cretz commented May 17, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant