177
archetypeID chasm.ArchetypeID,
178
lockPriority locks.Priority,
179
>
) (historyi.ReleaseWorkflowContextFunc, error) {
cache.go
180
>
if err := c.validateWorkflowID(workflowID); err != nil {
181
return nil, err
182
}
183
184
>
handler := shardContext.GetMetricsHandler().WithTags(
cache.go
185
>
metrics.OperationTag(metrics.HistoryCacheGetOrCreateCurrentScope),
186
>
metrics.CacheTypeTag(metrics.MutableStateCacheTypeTagValue),
187
>
metrics.NamespaceIDTag(namespaceID.String()),
188
>
)
189
>
metrics.CacheRequests.With(handler).Record(1)
190
>
start := time.Now()
191
>
defer func() { metrics.CacheLatency.With(handler).Record(time.Since(start)) }()
192
193
>
execution := commonpb.WorkflowExecution{
cache.go
194
>
WorkflowId: workflowID,
195
>
// using empty run ID as current workflow run ID
196
>
RunId: "",
197
>
}
198
>
199
>
_, weReleaseFn, err := c.getOrCreateWorkflowExecutionInternal(
200
>
ctx,
201
>
shardContext,
202
>
namespaceID,
203
>
&execution,
204
>
archetypeID,
205
>
handler,
206
>
true,
207
>
lockPriority,
208
>
)
209
>
210
>
metrics.ContextCounterAdd(ctx, metrics.HistoryWorkflowExecutionCacheLatency.Name(),
211
>
time.Since(start).Nanoseconds())
212
>
213
>
return weReleaseFn, err
214
}
215