-
Notifications
You must be signed in to change notification settings - Fork 19
fix: 243 tx to InTx for account,tab,user #258
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
Conversation
Default Project
|
Project |
Default Project
|
Branch Review |
staging
|
Run status |
|
Run duration | 00m 31s |
Commit |
|
Committer | Diyor Khaydarov |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
0
|
|
0
|
|
3
|
View all changes introduced in this branch ↗︎ |
@@ -55,7 +55,7 @@ func (c *AccountController) Register(r *mux.Router) { | |||
|
|||
setRouter := r.PathPrefix(c.basePath).Subrouter() | |||
setRouter.Use(commonMiddleware...) | |||
setRouter.Use(middleware.WithTransaction()) | |||
//setRouter.Use(middleware.WithTransaction()) |
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.
You can completely remove this line
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.
fixed
|
||
var createdUser user.User | ||
err = composables.InTx(ctx, func(txCtx context.Context) error { | ||
data, err = data.SetPassword(data.Password()) |
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.
This doesn't necessarily need to be part the transaction
modules/core/handlers/tab_handler.go
Outdated
} | ||
if err := h.tabService.CreateMany(ctxWithUser, tabs); err != nil { | ||
h.logger.Errorf("Failed to create tab for user %d: %v", user.ID(), err) | ||
err := composables.InTx(ctx, func(txCtx 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.
This call is not necessary since you're opening transactions inside service calls. If you want both calls to be part of a single transaction, create a service method that wraps these two operations in a single transaction
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.
made by calling the service
No description provided.