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

ConditionalComplete improvement: also check newly returned channel messages from state APIs #289

Open
longquanzheng opened this issue Jul 4, 2023 · 0 comments
Labels
enhancement New feature or request large

Comments

@longquanzheng
Copy link
Contributor

In the first iteration of conditionalComplete in #282, it may lose the messages published to the InternalChannel from State APIs. This could happen when the internalChannelPublishing is from StateApi response that are returned within the same Cadence/Temporal Workflow[Decision]TaskCompleted batch.

As workaround: user need to make sure that they don't have workflow state publishing the internal messages when using this ConditionalComplete feature,
As workflow 2: user uses persistence locking, to let the state API lock on the same field so that they won't execute at the same time(hence won't have the internalChannelPublishing in the same Cadence/Temporal Workflow[Decision]TaskCompleted batch.

There are a couple ways to "fix" or improve this behavior. For example, let the thread of having ConditionalComplete to "temporarily yield" so that other threads can execute, hence other threads can process the internalChannelPublishing from StateApi response.

To implement the temporarily yield, the current thread can open a new thread, which is to set a flag to true. And the current thread uses await to wait for the flag to be true. This will enforce the current thread to yield and then come back again when all other thread got a chance to run.

@longquanzheng longquanzheng added the enhancement New feature or request label Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request large
Projects
None yet
Development

No branches or pull requests

1 participant