mirror of
https://github.com/goharbor/harbor.git
synced 2024-09-29 22:07:32 +02:00
add transaction for artifact delete (#16512)
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
00350cef3e
commit
db900b56e2
@ -283,7 +283,9 @@ func (c *controller) getByTag(ctx context.Context, repository, tag string, optio
|
||||
}
|
||||
|
||||
func (c *controller) Delete(ctx context.Context, id int64) error {
|
||||
return orm.WithTransaction(func(ctx context.Context) error {
|
||||
return c.deleteDeeply(ctx, id, true)
|
||||
})(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