Skip to content

Commit c4ae79d

Browse files
committed
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.
1 parent b3f0687 commit c4ae79d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ Generally you will access the PostgreSQL server through a pool of clients. A cl
2121
var pg = require('pg');
2222
var conString = "postgres://username:password@localhost/database";
2323

24+
//this starts initializes a connection pool
25+
//it will keep idle connections open for a (configurable) 30 seconds
26+
//and set a limit of 20 (also configurable)
2427
pg.connect(conString, function(err, client, done) {
2528
if(err) {
2629
return console.error('error fetching client from pool', err);
@@ -34,7 +37,6 @@ pg.connect(conString, function(err, client, done) {
3437
}
3538
console.log(result.rows[0].number);
3639
//output: 1
37-
client.end();
3840
});
3941
});
4042
```

0 commit comments

Comments
 (0)