-
Notifications
You must be signed in to change notification settings - Fork 55
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
IWF-364: Fix conditional complete on messages of internalChannels from state APIs #490
Conversation
if p.IsUsingGlobalVersionSearchAttribute() && | ||
p.workflowProvider.GetBackendType() != service.BackendTypeCadence { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is just some minor cleanup that is not related to this ticket
// There are two cases this is needed: | ||
// 1. ContinueAsNew: | ||
// retrieve signals that after signal handler threads are stopped, | ||
// so that the signals can be carried over to next run by continueAsNew. | ||
// This includes both regular user signals and system signals | ||
// 2. Conditional close/complete workflow on signal/internal channel: | ||
// retrieve all signal/internal channel messages before checking the signal/internal channels | ||
func (sr *SignalReceiver) DrainAllUnreceivedSignals(ctx UnifiedContext) { | ||
func (sr *SignalReceiver) DrainAllReceivedButUnprocessedSignals(ctx UnifiedContext) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename the method to make it more clear(hopefully)
if versioner.IsAfterVersionOfYieldOnConditionalComplete() { | ||
// Just yield, by waiting on an empty lambda, nothing else. | ||
// It will let other workflow threads/coroutines to run. | ||
// This will drain the messages published from state APIs. | ||
// NOTE that this is extremely tricky in Cadence/Temporal programming model. | ||
// Read more: https://stackoverflow.com/questions/71356668/how-does-multi-threading-works-in-cadence-temporal-workflow | ||
//https://docs.temporal.io/encyclopedia/go-sdk-multithreading | ||
return provider.Await(ctx, func() bool { | ||
return true | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna trust this works as expected. Having tests would be beneficial and make it easier to understand and verify. Hope we can cover multi-threading soon so I can get a better grasp on it.
Closes #289 |
Description
Checklist
Related Issue
Closes #issue_number