This repository was archived by the owner on Dec 3, 2019. It is now read-only.
This repository was archived by the owner on Dec 3, 2019. It is now read-only.
PostgreSQLConnection.connect blocks for almost 6 seconds, even though it returns a Future #222
Open
Description
I tried this code (in Kotlin, but I guess it shouldn't matter),
All it does: creates PostgreSQLConnection
with all default values, calls connect
method on it, does nothing with the returned Future, and measures elapsed time.
If this call has to be blocking then maybe there's little point in returning Future because it doesn't save anything here, or maybe it's just a bug.
import com.github.mauricio.async.db.postgresql.PostgreSQLConnection
import com.github.mauricio.async.db.postgresql.column.PostgreSQLColumnDecoderRegistry
import com.github.mauricio.async.db.postgresql.column.PostgreSQLColumnEncoderRegistry
import com.github.mauricio.async.db.postgresql.util.URLParser
import com.github.mauricio.async.db.util.ExecutorServiceUtils
import com.github.mauricio.async.db.util.NettyUtils
import kotlin.system.measureTimeMillis
fun main(args: Array<String>) {
println(measureTimeMillis {
PostgreSQLConnection(
URLParser.DEFAULT(),
PostgreSQLColumnEncoderRegistry.Instance(),
PostgreSQLColumnDecoderRegistry.Instance(),
NettyUtils.DefaultEventLoopGroup(),
ExecutorServiceUtils.CachedExecutionContext()
).connect()
}) // prints something close to 5862 on my machine
}
I can translate it to Scala if you wish, that's not a big deal.
I'm using this library version: 'postgresql-async_2.12', version: "0.2.21"
Metadata
Metadata
Assignees
Labels
No labels