282
}
283
284
>
if _, err := r.failWorkflowTask(); err != nil {
workflow.go
285
return err
286
}
287
288
// do not persist the change right now, Workflow requires transaction
289
>
_, err := r.mutableState.AddWorkflowExecutionTerminatedEvent(
workflow.go
290
>
common.FailureReasonWorkflowTerminationDueToVersionConflict,
291
>
payloads.EncodeString(fmt.Sprintf("terminated by version: %v", incomingLastWriteVersion)),
292
>
consts.IdentityHistoryService,
293
>
false,
294
>
nil, // No links necessary.
295
>
)
296
>
297
>
// Don't abort updates here for a few reasons:
298
>
// 1. There probably no update waiters for Wf which is about to be terminated,
299
>
// 2. MS is not persisted yet, and updates should be aborted after MS is persisted, which is not trivial in this case,
300
>
// 3. New replication version will force update registry reload and waiters will get errors.
301
>
// r.GetContext().UpdateRegistry(context.Background(), nil).Abort(update.AbortReasonWorkflowTerminated)
302
>
303
>
return err
304
}
305