feat: user service uses database.QueryExecutor - #263
Closed
IAM-marco wants to merge 2 commits into
Closed
Conversation
…ry, UserPasswordRepository, and crypto.Hasher
test: add unit tests for UserService.SetPassword
|
@IAM-marco must be a member of the zitadel team on Vercel to deploy. Learn more about collaboration on Vercel and other options here. |
vitorbari
reviewed
Jun 12, 2026
| return domain.ErrInternal(database.ErrNotABeginner) | ||
| } | ||
|
|
||
| tx, err := beginner.Begin(ctx, nil) |
Contributor
There was a problem hiding this comment.
One of the goals, is to be able to call CreateUser and SetPassword within the same transaction. How will this nested transaction behave?
Contributor
Author
|
Closing as we are migrating to a new approach to handle expensive cryptographic ops outside of DB tx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
userService.SetPassword() needs to start a transaction or re-use an existing one. However,
database.Pool, which is what is used by userService to access DB, has no idea of whether a transaction is started or not. This is the DB client job. So, when trying to create a password for a user in an already open transaction, the procedure fails, because the system attempts to open another transaction, instead of re-using the existing one.Solution
database.Poolparamter todatabase.QueryExecutordatabase.Beginnerto make sure the client can handle transactionbeginner.Begin()to gracefully start a new transaction or re-use the existing oneExtras