-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add transaction for artifact delete #16506
Conversation
Codecov Report
@@ Coverage Diff @@
## main #16506 +/- ##
==========================================
- Coverage 67.44% 67.28% -0.17%
==========================================
Files 949 949
Lines 78812 78382 -430
Branches 2321 2321
==========================================
- Hits 53158 52742 -416
+ Misses 22105 22093 -12
+ Partials 3549 3547 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@@ -311,7 +311,12 @@ func (c *controller) Delete(ctx context.Context, id int64) error { | |||
if err != nil { | |||
return err | |||
} | |||
return c.deleteDeeply(ctx, id, true, len(accs) > 0) | |||
if err := orm.WithTransaction(func(ctx context.Context) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return orm.WithTransaction(func(ctx context.Context) error {
return c.deleteDeeply(ctx, id, true, len(accs) > 0)
})(orm.SetTransactionOpNameToContext(ctx, "tx-delete-artifact-delete"))
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>
b0f394b
to
00fc86f
Compare
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>
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