1215
}
1216
1217
>
func (d *WorkflowRunner) handleSetManager(ctx workflow.Context, args *deploymentspb.SetManagerIdentityArgs) (*deploymentspb.SetManagerIdentityResponse, error) {
workflow.go
1218
>
if err := d.preUpdateChecks(ctx); err != nil {
1219
return nil, err
1220
}
1221
1222
// use lock to enforce only one update at a time
1224
>
if err != nil {
1225
d.logger.Error("Could not acquire workflow lock")
1226
return nil, serviceerror.NewDeadlineExceeded("Could not acquire workflow lock")
1227
}
1229
>
// Even if the update doesn't change the state we mark it as dirty because of created history events.
1230
>
d.setStateChanged()
1231
>
d.lock.Unlock()
1232
>
}()
1233
1234
>
err = d.validateStateBeforeAcceptingSetManager(args)
workflow.go
1235
>
if err != nil {
1236
return nil, err
1237
}
1238
1239
>
prevManager := d.State.ManagerIdentity
workflow.go
1240
>
1241
>
// update local state
1242
>
d.State.ManagerIdentity = args.ManagerIdentity
1243
>
d.State.LastModifierIdentity = args.Identity
1244
>
d.State.ConflictToken, _ = workflow.Now(ctx).MarshalBinary()
1245
>
1246
>
// no need to update memo because identity and manager identity are not in it
1247
>
return &deploymentspb.SetManagerIdentityResponse{
1248
>
PreviousManagerIdentity: prevManager,
1249
>
ConflictToken: d.State.ConflictToken,
1250
>
}, nil
1251
}
1252