46
workflowCache wcache.Cache,
47
logger log.Logger,
49
>
50
>
return &HSMStateReplicatorImpl{
51
>
shardContext: shardContext,
52
>
workflowCache: workflowCache,
53
>
logger: log.With(logger, tag.ComponentHSMStateReplicator),
54
>
}
55
>
}
56
57
func (r *HSMStateReplicatorImpl) SyncHSMState(
58
ctx context.Context,
59
request *historyi.SyncHSMRequest,
61
>
namespaceID := namespace.ID(request.GetNamespaceID())
62
>
execution := &commonpb.WorkflowExecution{
63
>
WorkflowId: request.GetWorkflowID(),
64
>
RunId: request.GetRunID(),
65
>
}
66
>
67
>
lastItem, err := versionhistory.GetLastVersionHistoryItem(request.EventVersionHistory)
68
>
if err != nil {
69
return err
70
}
71
73
>
ctx,
74
>
r.shardContext,
75
>
namespaceID,
76
>
execution,
77
>
locks.PriorityHigh,
78
>
)
79
>
if err != nil {
80
return err
81
}
83
85
>
if err != nil {
86
if _, isNotFound := err.(*serviceerror.NotFound); isNotFound {
87
return serviceerrors.NewRetryReplication(