Rework cursor/stream documentation Pt 2
-
Currently the documentation does not show/mention how/that the connection should be closed. Rework the documentation so that we mention that and how a connection needs to be closed. What happened to me was that I grabbed the example from the documentation and eventually spend a lot of time figuring out why the query didn't work after running OK a few times (matching the connection pool size). That might save users some minutes/hours of debugging time.
-
Also, the
PgStreamhas aclose()method, should be also called explicitly. If so, add it to the documentation and specify where should it be closed (at theendHandler()?)
At the end, this is what I did:
stream.handler(row -> {
...
}).endHandler(v -> {
tx.commit();
stream.close();
connection.close();
}).exceptionHandler(err -> {
stream.close();
connection.close();
});
do you mind contributing this to the doc ?
Sure, I assume PgStream needs to be closed then, right?
yes, however please read this too and let me know what you think of it https://github.com/reactiverse/reactive-pg-client/issues/134 as a comment on the issue