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

Can't run query because there is one query pending already #131

Open
bodtx opened this issue Dec 7, 2018 · 1 comment
Open

Can't run query because there is one query pending already #131

bodtx opened this issue Dec 7, 2018 · 1 comment

Comments

@bodtx
Copy link

bodtx commented Dec 7, 2018

I thought there was a queue system or sthg like that but when I do too many request with my connection pool, I have these error:
ERROR com.github.mauricio.async.db.postgresql.PostgreSQLConnection - Can't run query because there is one query pending already

Each request are done from a connection of the pool then Connection is closed:

res.result().queryStream(sqlCommand, resultSetStream -> { //do the job}).close();

here is my pool setup

JsonObject postgreSQLClientConfig = new JsonObject().put("host", "10.203.62.160").put("port", 5432).put("username", "postgres").put("password", "postgres").put("database", "XXX") .put("maxPoolSize", 3); SQLClient postgreSQLClient = PostgreSQLClient.createShared(vertx, postgreSQLClientConfig);

I thought connection taken from the pool where free from query, do I have to check the connection state and queue the query myself?

@andy-yx-chen
Copy link
Contributor

res.result().queryStream(sqlCommand, resultSetStream -> { //do the job}).close();

This actually will return the connection before the query finishes, it's not surprise that you get the exception, you should close the connection inside //do the job

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

No branches or pull requests

2 participants