mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-15 12:11:23 +01:00
add transaction for artifact delete (#16506)
Add transaction for artifact deletion, given API has the transaction when to call artifact controller but other object may not, for example jobservice job. Here, force add the tx to ensure all the things can be rolled back. Signed-off-by: Wang Yan <wangyan@vmware.com>
This commit is contained in:
parent
6673841526
commit
ef991ae0c0
@ -311,7 +311,9 @@ func (c *controller) Delete(ctx context.Context, id int64) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return c.deleteDeeply(ctx, id, true, len(accs) > 0)
|
||||
return orm.WithTransaction(func(ctx context.Context) error {
|
||||
return c.deleteDeeply(ctx, id, true, len(accs) > 0)
|
||||
})(orm.SetTransactionOpNameToContext(ctx, "tx-delete-artifact-delete"))
|
||||
}
|
||||
|
||||
// "isRoot" is used to specify whether the artifact is the root parent artifact
|
||||
|
Loading…
Reference in New Issue
Block a user