{master} db tweaks
parent
e83919a5b1
commit
a2923d41fa
|
@ -18,7 +18,7 @@ final class AsyncDb(
|
|||
|
||||
private val dbName = uri.db | "lichess"
|
||||
|
||||
lazy val connection: Future[MongoConnection] = driver.connect(uri, name.some)
|
||||
private lazy val connection: Future[MongoConnection] = driver.connect(uri, name.some)
|
||||
|
||||
private def db: Future[DefaultDB] = connection.flatMap(_ database dbName)
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ final class Env(
|
|||
lifecycle: ApplicationLifecycle
|
||||
)(implicit ec: scala.concurrent.ExecutionContext) {
|
||||
|
||||
private lazy val driver = new AsyncDriver(appConfig.get[Config]("mongodb").some)
|
||||
private val driver = new AsyncDriver(appConfig.get[Config]("mongodb").some)
|
||||
|
||||
def asyncDb(name: String, uri: MongoConnection.ParsedURI) = new AsyncDb(
|
||||
name = name,
|
||||
|
@ -24,9 +24,7 @@ final class Env(
|
|||
driver = driver
|
||||
)
|
||||
|
||||
lifecycle.addStopHook { () =>
|
||||
scala.concurrent.Future(driver.close())
|
||||
}
|
||||
lifecycle.addStopHook(driver.close)
|
||||
}
|
||||
|
||||
object DbConfig {
|
||||
|
|
Loading…
Reference in New Issue