Skip to content

Commit

Permalink
docs update.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaly-t committed Jun 19, 2016
1 parent ba8151a commit 302e5ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions lib/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ var $arr = require('./array'),
* handlers that each {@link Database} object needs to set up.
*
* **Starting with v.4.7.0:**
*
*
* If you create more than one {@link Database} object for the same connection, you will see the following warning
* in a development environment (when `NODE_ENV` = `development`):
*
*
* `WARNING: Creating a duplicate database object for the same connection`.
*
*
* And since every {@link Database} object needs to set up its own event listeners, you are likely to see the following
* warning in the console also:
*
*
* `Warning: Possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit`.
*
*
* If you ever see any of those warnings, do not try increasing the limit, this won't help you.
* Instead, rectify your {@link Database} object initialization, so there is only one object per connection details.
* See the example provided below.
Expand Down Expand Up @@ -1214,8 +1214,11 @@ function checkForDuplicates(cn, config) {
var cnKey = JSON.stringify(cn);
if (cnKey in dbObjects) {
if (!config.options.noWarnings) {
// from the call stack, we take only lines starting with the client's
// source code, and only those that contain a full path inside brackets,
// indicating a reference to the client's source code:
var stack = new Error().stack.split('\n').slice(4).filter(function (line) {
return line.match(/\(.*(\\+|\/+).*\)/);
return line.match(/\(.*(\\+|\/+).*\)/); // contains \ or / inside ()
}).join('\n');
var msg = "WARNING: Creating a duplicate database object for the same connection." +
EOL + stack + EOL;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pg-promise",
"version": "4.7.0",
"version": "4.7.1",
"description": "Promises interface for PostgreSQL",
"main": "lib/index.js",
"scripts": {
Expand Down

0 comments on commit 302e5ad

Please sign in to comment.