Using
pool.release();
pool.drain();
May (not necessarily) result in the error below
Connection lost - Cannot call write after a stream was destroyed
The pool.release methods calls the connection.reset method. This methods executes SQL queries to reset to the initial state of the connection. pool.release does not use promises, so pool.drain in the above example is immediately called afterwards. pool.drain closes the connections. If one of these connections still have a request connection pending (or any other request!) it results in the above mentioned error.
I will provide a PR containing a fix soon.
Using
May (not necessarily) result in the error below
Connection lost - Cannot call write after a stream was destroyedThe
pool.releasemethods calls theconnection.resetmethod. This methods executes SQL queries to reset to the initial state of the connection.pool.releasedoes not use promises, sopool.drainin the above example is immediately called afterwards.pool.draincloses the connections. If one of these connections still have a request connection pending (or any other request!) it results in the above mentioned error.I will provide a PR containing a fix soon.