ibmdb / node-ibm_db

IBM DB2 and IBM Informix bindings for node
MIT License
188 stars 151 forks source link

added async pool initialization #953

Closed girish-jha closed 7 months ago

girish-jha commented 9 months ago

Hi,

I have added the async initialization of the pool. With this we are not facing the error that was reported in https://github.com/ibmdb/node-ibm_db/issues/952

bimalkjha commented 9 months ago

@girish-jha Async pool initialization will not give any perf benefit for few initial connections as application will be trying to get connection from the pool while it has no connection yet when connection takes 3-4 sec or time. After few minutes, it should get stabilized. Could you please explain why Async init solves your problem but not the Sync Init? How it makes difference in behavior?

Also, please undo all the spacing and syntax related changes and keep only the initAsync related code. Its due to your editor which modified the spacing and syntax automatically. Check diff on github in PR, it is showing 2.5k lines changed! Thanks.

girish-jha commented 9 months ago

Hi @bimalkjha, I have removed the unwanted formatting. As for why it's solving the issue I mentioned, I do not have a definitive answer for that. Maybe because of the differences between db.open & db.openSync. Let me dig deeper to understand and come back on this.

bimalkjha commented 9 months ago

@girish-jha I would suggest to add testAsyncConnections function in https://github.com/ibmdb/node-ibm_db/blob/master/test/test-pool-close.js too to test the added functionality. Thanks.

bimalkjha commented 8 months ago

@girish-jha Async function should be able to accept callback function too. Please update code to accept callback function and return promise only if callback is not passed as coded for other async apis. Thanks.

bimalkjha commented 7 months ago

Changes has been pushed with last commit. Thanks.