1154
ctx context.Context,
1155
ref chasm.ComponentRef,
1156
>
) (historyi.ShardContext, api.WorkflowLease, error) {
chasm_engine.go
1157
>
shardContext, err := e.getShardContext(ref)
1158
>
if err != nil {
1159
return nil, nil, err
1160
}
1161
1162
>
consistencyChecker := api.NewWorkflowConsistencyChecker(
chasm_engine.go
1163
>
shardContext,
1164
>
e.executionCache,
1165
>
)
1166
>
1167
>
lockPriority := locks.PriorityHigh
1168
>
callerType := headers.GetCallerInfo(ctx).CallerType
1169
>
if callerType == headers.CallerTypeBackgroundHigh ||
1170
>
callerType == headers.CallerTypeBackgroundLow ||
1171
>
callerType == headers.CallerTypePreemptable {
1172
lockPriority = locks.PriorityLow
1173
}
1174
1176
>
if err != nil {
1177
return nil, nil, err
1178
}
1179
1181
>
var needReload bool
1182
>
executionLease, err := consistencyChecker.GetChasmLeaseWithConsistencyCheck(
1183
>
ctx,
1184
>
nil,
1185
>
func(mutableState historyi.MutableState) bool {
1186
err := mutableState.ChasmTree().IsStale(ref)
1187
needReload = errors.Is(err, consts.ErrStaleState)