17
shard historyi.ShardContext,
18
workflowConsistencyChecker api.WorkflowConsistencyChecker,
19
>
) (resp *historyservice.RequestCancelWorkflowExecutionResponse, retError error) {
api.go
20
>
namespaceEntry, err := api.GetActiveNamespace(shard, namespace.ID(req.GetNamespaceId()), req.CancelRequest.WorkflowExecution.WorkflowId)
21
>
if err != nil {
22
return nil, err
23
}
24
>
namespaceID := namespaceEntry.ID()
api.go
25
>
26
>
request := req.CancelRequest
27
>
parentExecution := req.ExternalWorkflowExecution
28
>
childWorkflowOnly := req.GetChildWorkflowOnly()
29
>
workflowID := request.WorkflowExecution.WorkflowId
30
>
runID := request.WorkflowExecution.RunId
31
>
firstExecutionRunID := request.FirstExecutionRunId
32
>
if len(firstExecutionRunID) != 0 {
33
runID = ""
34
}
35
36
>
err = api.GetAndUpdateWorkflowWithNew(
api.go
37
>
ctx,
38
>
nil,
39
>
definition.NewWorkflowKey(
40
>
namespaceID.String(),
41
>
workflowID,
42
>
runID,
43
>
),
44
>
func(workflowLease api.WorkflowLease) (*api.UpdateWorkflowAction, error) {
45
mutableState := workflowLease.GetMutableState()
46
if !mutableState.IsWorkflowExecutionRunning() {