From c4ae79db399d358015a6a94113298f3310be5e91 Mon Sep 17 00:00:00 2001 From: Brian C Date: Thu, 9 Apr 2015 09:43:55 -0400 Subject: [PATCH] Update README.md Calling `client.end()` on a client in the pool is folly and should not be done. I mistakenly accepted a pull request with bad documentation. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8957ad89..fa890793 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,9 @@ Generally you will access the PostgreSQL server through a pool of clients. A cl var pg = require('pg'); var conString = "postgres://username:password@localhost/database"; +//this starts initializes a connection pool +//it will keep idle connections open for a (configurable) 30 seconds +//and set a limit of 20 (also configurable) pg.connect(conString, function(err, client, done) { if(err) { return console.error('error fetching client from pool', err); @@ -34,7 +37,6 @@ pg.connect(conString, function(err, client, done) { } console.log(result.rows[0].number); //output: 1 - client.end(); }); }); ```