Skip to content
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

Why is Hikari set to isAutoCommit = false #106

Closed
nhalase opened this issue Apr 11, 2022 · 2 comments
Closed

Why is Hikari set to isAutoCommit = false #106

nhalase opened this issue Apr 11, 2022 · 2 comments

Comments

@nhalase
Copy link

nhalase commented Apr 11, 2022

Also, shouldn't the newSuspendedTransaction {} block in DatabaseFactory be using Dispatchers.IO? That's how JetBrains does it in the Ktor docs.

Mostly, I'm just wondering why you would want Hikari set to isAutoCommit = false.

Thanks!

@raharrison
Copy link
Owner

Yep thanks, should be using Dispatchers.IO will update that.

As for the autoCommit it was/is due to the fact that Exposed requires all queries to be run within a transaction anyway, so it will always manage the commit itself. Ref below issue which also discusses it more. Having auto-commit set to true by default on the connections Hikari creates and then Exposed setting it to false every time isn't great performance wise so I set it straight on the pool config.

The situation might be different now but I can still see the same code segments in place. Really is just an Exposed thing as opposed to anything else with Ktor/Hikari etc.

JetBrains/Exposed#306

Which references https://github.com/JetBrains/Exposed/blob/master/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/transactions/ThreadLocalTransactionManager.kt

@nhalase
Copy link
Author

nhalase commented Apr 19, 2022

Thanks for the insight! I feel like Exposed should provide a bit more FAQ on their wiki about that potentiality. Really helpful, though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants