22
shardContext historyi.ShardContext,
23
ctxLookup api.WorkflowConsistencyChecker,
24
>
) (*historyservice.PollWorkflowExecutionUpdateResponse, error) {
api.go
25
>
waitStage := req.GetRequest().GetWaitPolicy().GetLifecycleStage()
26
>
updateRef := req.GetRequest().GetUpdateRef()
27
>
wfexec := updateRef.GetWorkflowExecution()
28
>
wfKey, upd, err := func() (*definition.WorkflowKey, *update.Update, error) {
29
>
workflowLease, err := ctxLookup.GetWorkflowLease(
30
>
ctx,
31
>
nil,
32
>
definition.NewWorkflowKey(
33
>
req.GetNamespaceId(),
34
>
wfexec.GetWorkflowId(),
35
>
wfexec.GetRunId(),
36
>
),
37
>
locks.PriorityHigh,
38
>
)
39
>
if err != nil {
40
return nil, nil, err
41
}
42
>
release := workflowLease.GetReleaseFn()
api.go
43
>
defer release(nil)
44
>
wfCtx := workflowLease.GetContext()
45
>
upd := wfCtx.UpdateRegistry(ctx).Find(ctx, updateRef.UpdateId)
46
>
wfKey := wfCtx.GetWorkflowKey()
47
>
return &wfKey, upd, nil
48
}()
50
return nil, err
51
}
53
return nil, serviceerror.NewNotFoundf("update %q not found", updateRef.GetUpdateId())
54
}