From 6f89e40dee4c865f04b813be3fd4641b467becb3 Mon Sep 17 00:00:00 2001 From: Dan Bernardic Date: Tue, 16 Sep 2014 10:11:39 -0500 Subject: [PATCH] Added pool.end() --- Readme.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Readme.md b/Readme.md index 51b9d14d2..4efe7ed43 100644 --- a/Readme.md +++ b/Readme.md @@ -320,6 +320,22 @@ being taken from the top of the pool and returning to the bottom. When a previous connection is retrieved from the pool, a ping packet is sent to the server to check if the connection is still good. +## Terminating all the connections in a pool + +When you are done using the pool, you have to end all the connections or your +script will hang until the db server closes them. To end all the connections +in the pool, use +[pool.end()](https://github.com/felixge/node-mysql/blob/master/lib/Pool.js#L121) + +```js +var mysql = require('mysql'); +var pool = mysql.createPool(...); + +// ... Do your queries + +pool.end(); +``` + ## Pool options Pools accept all the same options as a connection. When creating a new