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

feat: custom connection factory when using withSession #1271

Merged

Conversation

sebastian-alfers
Copy link
Contributor

@sebastian-alfers sebastian-alfers commented Nov 26, 2024

Follow up to #1254

/**
* Provide a custom connectionFactory and an optional config path to load closeCallsExceeding from.
*/
def withSession[A](system: ActorSystem[_], connectionFactory: ConnectionFactory, configPath: Option[String])(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should have configPath in this one. It's only used for closeCallsExceeding and we can instead take that from the default connectionFactoryConfigPath.

@sebastian-alfers sebastian-alfers marked this pull request as ready for review November 26, 2024 08:29
@@ -37,7 +38,16 @@ object R2dbcSession {
fun: R2dbcSession => Future[A]): Future[A] = {
val connectionFactoryProvider = ConnectionFactoryProvider(system)
val connectionFactory = connectionFactoryProvider.connectionFactoryFor(connectionFactoryConfigPath)
val poolSettings = new ConnectionPoolSettings(system.settings.config.getConfig(connectionFactoryConfigPath))
withSession(system, connectionFactory)(fun)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it should still use the poolSettings.closeCallsExceeding from the given connectionFactoryConfigPath

…ladsl/R2dbcSession.scala

Co-authored-by: Patrik Nordwall <[email protected]>
Copy link
Member

@patriknw patriknw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@patriknw patriknw merged commit c5a614b into akka:main Nov 26, 2024
21 of 22 checks passed
@patriknw patriknw added this to the 1.6.4 milestone Nov 26, 2024
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

Successfully merging this pull request may close these issues.

2 participants