private final val testFailoverStrategy = FailoverStrategy(retries = 40)
val connection = driver.connection(parsedUri)
// the next line blocks
val db = connection.database(parsedUri.db.get, testFailoverStrategy)
Is this expected? This returns a Future[DefaultDB] so I see no reason to block the calling thread.
Thanks,
F
scala> c.database(dbName).map { _ => println("_database") }; println("Foo")
Foo
_database
--
You received this message because you are subscribed to a topic in the Google Groups "ReactiveMongo - http://reactivemongo.org" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/reactivemongo/-BpcLtvVm9g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to reactivemongo+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
val start = Instant.now()
val f = connection.database("test").map { _ => println("_database") }
val duration = java.time.Duration.between(start, Instant.now())
println( s"$duration Foo")
As you see in the pasted test, `database(..)` is not blocking.BTW, assigning such resolution to a `val` is highly discouraged (as indicated in the documentation).
--