I was looking at the API docs and I can see there is the possibility of handling a disconnection event. However, I can't see how to trigger the end of connection.
I can also see that the client is based on node-postgres. However, node-postgres client has an end() method, which I can't find with pg-promise
Is there a way to trigger the disconnection?
There are events connect and disconnect that represent virtual connections, i.e. from the connection pool.
This library works only via the connection pool, so you never physically/directly open or close connections, only virtually, which you can monitor through those events.
That's what I thought from reading the docs. However, the problem is that after my program finishes, it still hangs until connection is dropped.
If there was a way to close the connection, the app would be able to exit when it's all done.
This is documented in Library de-initialization and in all examples.
That's what I was looking for! Thanks
Can someone please explain how is a connection released? Is it released and free to be used when a query ends? I'm running into timeout issues in AWS Lambda and I'm investigating where the problem is, and the pool management is a bit of a mystery to me. Thanks.
Most helpful comment
That's what I thought from reading the docs. However, the problem is that after my program finishes, it still hangs until connection is dropped.
If there was a way to close the connection, the app would be able to exit when it's all done.