File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -364,6 +364,24 @@ pool.on('enqueue', function () {
364364});
365365```
366366
367+ ## Closing all the connections in a pool
368+
369+ When you are done using the pool, you have to end all the connections or the
370+ Node.js event loop will stay active until the connections are closed by the
371+ MySQL server. This is typically done if the pool is used in a script or when
372+ trying to gracefully shutdown a server. To end all the connections in the
373+ pool, use the ` end ` method on the pool:
374+
375+ ``` js
376+ pool .end (function (err ) {
377+ // all connections in the pool have ended
378+ });
379+ ```
380+
381+ The ` end ` method takes an _ optional_ callback that you can use to know once
382+ all the connections have ended. The connections end _ gracefully_ , so all
383+ pending queries will still complete and the time to end the pool will vary.
384+
367385## PoolCluster
368386
369387PoolCluster provides multiple hosts connection. (group & retry & selector)
You can’t perform that action at this time.
0 commit comments