-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Adds validation for workflow task for child start and cancel #599
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
Changes from 3 commits
9b32927
aa16657
c62ec2f
1c8200a
b21d1d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,12 +54,13 @@ type ( | |
| namespaceEntry *cache.NamespaceCacheEntry | ||
|
|
||
| // internal state | ||
| hasBufferedEvents bool | ||
| failWorkflowTaskInfo *failWorkflowTaskInfo | ||
| activityNotStartedCancelled bool | ||
| continueAsNewBuilder mutableState | ||
| stopProcessing bool // should stop processing any more commands | ||
| mutableState mutableState | ||
| hasBufferedEvents bool | ||
| failWorkflowTaskInfo *failWorkflowTaskInfo | ||
| activityNotStartedCancelled bool | ||
| continueAsNewBuilder mutableState | ||
| stopProcessing bool // should stop processing any more commands | ||
| mutableState mutableState | ||
| initiatedChildExecutionsInSession map[string]struct{} // Set of initiated child executions in the workflow task | ||
|
||
|
|
||
| // validation | ||
| attrValidator *commandAttrValidator | ||
|
|
@@ -96,12 +97,13 @@ func newWorkflowTaskHandler( | |
| namespaceEntry: namespaceEntry, | ||
|
|
||
| // internal state | ||
| hasBufferedEvents: mutableState.HasBufferedEvents(), | ||
| failWorkflowTaskInfo: nil, | ||
| activityNotStartedCancelled: false, | ||
| continueAsNewBuilder: nil, | ||
| stopProcessing: false, | ||
| mutableState: mutableState, | ||
| hasBufferedEvents: mutableState.HasBufferedEvents(), | ||
| failWorkflowTaskInfo: nil, | ||
| activityNotStartedCancelled: false, | ||
| continueAsNewBuilder: nil, | ||
| stopProcessing: false, | ||
| mutableState: mutableState, | ||
| initiatedChildExecutionsInSession: make(map[string]struct{}), | ||
|
||
|
|
||
| // validation | ||
| attrValidator: attrValidator, | ||
|
|
@@ -582,6 +584,7 @@ func (handler *workflowTaskHandlerImpl) handleCommandRequestCancelExternalWorkfl | |
| return handler.attrValidator.validateCancelExternalWorkflowExecutionAttributes( | ||
| namespaceID, | ||
| targetNamespaceID, | ||
| handler.initiatedChildExecutionsInSession, | ||
| attr, | ||
| ) | ||
| }, | ||
|
|
@@ -594,6 +597,7 @@ func (handler *workflowTaskHandlerImpl) handleCommandRequestCancelExternalWorkfl | |
| _, _, err := handler.mutableState.AddRequestCancelExternalWorkflowExecutionInitiatedEvent( | ||
| handler.workflowTaskCompletedID, cancelRequestID, attr, | ||
| ) | ||
|
|
||
| return err | ||
| } | ||
|
|
||
|
|
@@ -776,6 +780,10 @@ func (handler *workflowTaskHandlerImpl) handleCommandStartChildWorkflow( | |
| _, _, err = handler.mutableState.AddStartChildWorkflowExecutionInitiatedEvent( | ||
| handler.workflowTaskCompletedID, requestID, attr, | ||
| ) | ||
| if err == nil { | ||
| // Keep track of all child initiated commands in this workflow task to validate request cancel commands | ||
| handler.initiatedChildExecutionsInSession[attr.GetWorkflowId()] = struct{}{} | ||
| } | ||
| return err | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.