brianc / node-libpq

Simple, low level native bindings to PostgreSQL's libpq from node.js
111 stars 41 forks source link

Avoid assertion error from uv_close on executing finish() twice #88

Closed frakti closed 1 year ago

frakti commented 2 years ago

This is in response to failed integration tests in pg module after recent changes in this module (#87).

Those tests failed due to client.end() was triggered two times. It is somehow related to the fact that drain event was triggered two times in here. Basically changing addition of that listener from client.on('drain', ...) to client.once('drain', ...), also solves the problem but I have a feeling that it would hide real issue.

After fix in this PR tests are passing but I'm not convinced if it's a complete solution for those failed tests either. I would say it's just a part of solution to cover unusual case.

brianc commented 1 year ago

Thank you!!