256
execution *workflowpb.WorkflowExecutionInfo,
257
logger log.Logger,
259
>
260
>
logger = log.With(logger, tag.WorkflowID(execution.Execution.GetWorkflowId()), tag.WorkflowRunID(execution.Execution.GetRunId()))
261
>
262
>
logger.Info("Deleting workflow execution from visibility.")
263
>
_, err := a.historyClient.DeleteWorkflowVisibilityRecord(ctx, &historyservice.DeleteWorkflowVisibilityRecordRequest{
264
>
NamespaceId: nsID.String(),
265
>
Execution: execution.GetExecution(),
266
>
WorkflowStartTime: execution.StartTime,
267
>
WorkflowCloseTime: execution.CloseTime,
268
>
})
269
>
switch err.(type) {
270
>
case nil:
271
>
// Indicates that main and visibility stores were in inconsistent state.
272
>
metrics.DeleteExecutionsSuccessCount.With(a.metricsHandler.WithTags(metrics.NamespaceTag(nsName.String()))).Record(1)
273
>
logger.Info("Workflow execution deleted from visibility.")
274
>
return 1, 0
275
>
case *serviceerror.NotFound:
276
>
// Indicates that someone else deleted workflow execution.
277
>
logger.Error("Workflow execution is not found in visibility store.")
278
>
return 0, 0
279
default:
280
metrics.DeleteExecutionsFailureCount.With(a.metricsHandler.WithTags(metrics.NamespaceTag(nsName.String()))).Record(1)