-
-
Notifications
You must be signed in to change notification settings - Fork 558
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
Have a single SqlxDatabase
instance per process
#7313
Comments
I want to try this issue. |
@u-na-gi That's awesome, this is all yours. Please let us know if you have any questions as you explore. You can also ask questions on the contributors discord https://discord.ockam.io |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Current behavior
There are some places where we are creating multiple
SqlxDatabase
instances, like here.Desired behavior
The
SqlxDatabse
struct should be created once per db file/process (we currently have only one db file).One way to achieve this would be to add a
OnceLock
inside theSqlxDatabase
struct so that it gets initialized only once in thecreate
function.Another approach would be to investigate how can we refactor the creation of the database instance so it's just created once. That would mean detecting all the places where we are creating the database object multiple times and refactoring them accordingly.
The text was updated successfully, but these errors were encountered: