506
}
507
508
>
func (d *VersionWorkflowRunner) handleDeleteVersion(ctx workflow.Context, args *deploymentspb.DeleteVersionArgs) error {
version_workflow.go
509
>
if err := d.preUpdateChecks(ctx); err != nil {
510
return err
511
}
512
513
// use lock to enforce only one update at a time
515
>
if err != nil {
516
d.logger.Error("Could not acquire workflow lock in version workflow", "error", err)
517
return err
518
}
519
// also lock compute config lock to ensure that the compute config is not updated while the version is being deleted.
521
>
if err != nil {
522
d.logger.Error("Could not acquire compute config lock in version workflow", "error", err)
523
return err
524
}
526
>
// although the handler might have not changed the state and had returned an error, still
527
>
// it's better to CaN because some history events are built now.
528
>
d.setStateChanged()
529
>
d.computeConfigLock.Unlock()
530
>
d.lock.Unlock()
531
>
}()
532
534
// already deleted, returning success so it is idempotent
535
return nil
536
}
537
539
// wait until deployment workflow started
540
//nolint:staticcheck // SA1019