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

V2 of waitForStateCompletion API using synchronous update feature #349

Open
longquanzheng opened this issue Sep 18, 2023 · 0 comments
Open

Comments

@longquanzheng
Copy link
Contributor

longquanzheng commented Sep 18, 2023

The current implementation uses a sub workflow: #345 requires to provide WaitingForCompletionStateExecutionIds on starting workflow which is cumbersome to use. It's required because we want minimize the initiation of these sub workflows as optimization.

Additionally, it's not efficient because of the overhead of starting/signaling another workflow. It consume quite a lot of actions

A better way is:

  • Extend the stateExecutionCounter to track the completed state executionId
  • Use synchronous update with workflow.Await( ()-> stateExecutionCounter.stateExecuctionCompleted(stateExeId) ) in the handler to wait for the execution

Note that continueAsNew need to be handled properly:

  • In validator, it should check if the workflow has met continueAsNew threshold. If so, then return error
  • In the workflow.Await(...) should also check continueAsNew threshold to return error so that workflow can do a continueAsNew
  • The API service need to retry when continueAsNew interrupts the waiting
  • returning state completion output will not be supported

Also, it doesn't allow reuse workflowId for different executions, because of the RunID issues in Temporal. This v2 can solve the problems

Note that sync update feature is not prod ready in Temporal yet. We will start working on it when it is ready.

@longquanzheng longquanzheng changed the title Re-design waitForStateCompletion API using synchronous update feature V2 of waitForStateCompletion API using synchronous update feature from Temporal when it's available in production Dec 19, 2023
@longquanzheng longquanzheng changed the title V2 of waitForStateCompletion API using synchronous update feature from Temporal when it's available in production V2 of waitForStateCompletion API using synchronous update feature Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant