Skip to content

Commit 302e5ad

Browse files
committed
docs update.
1 parent ba8151a commit 302e5ad

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

lib/database.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ var $arr = require('./array'),
2929
* handlers that each {@link Database} object needs to set up.
3030
*
3131
* **Starting with v.4.7.0:**
32-
*
32+
*
3333
* If you create more than one {@link Database} object for the same connection, you will see the following warning
3434
* in a development environment (when `NODE_ENV` = `development`):
35-
*
35+
*
3636
* `WARNING: Creating a duplicate database object for the same connection`.
37-
*
37+
*
3838
* And since every {@link Database} object needs to set up its own event listeners, you are likely to see the following
3939
* warning in the console also:
40-
*
40+
*
4141
* `Warning: Possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit`.
42-
*
42+
*
4343
* If you ever see any of those warnings, do not try increasing the limit, this won't help you.
4444
* Instead, rectify your {@link Database} object initialization, so there is only one object per connection details.
4545
* See the example provided below.
@@ -1214,8 +1214,11 @@ function checkForDuplicates(cn, config) {
12141214
var cnKey = JSON.stringify(cn);
12151215
if (cnKey in dbObjects) {
12161216
if (!config.options.noWarnings) {
1217+
// from the call stack, we take only lines starting with the client's
1218+
// source code, and only those that contain a full path inside brackets,
1219+
// indicating a reference to the client's source code:
12171220
var stack = new Error().stack.split('\n').slice(4).filter(function (line) {
1218-
return line.match(/\(.*(\\+|\/+).*\)/);
1221+
return line.match(/\(.*(\\+|\/+).*\)/); // contains \ or / inside ()
12191222
}).join('\n');
12201223
var msg = "WARNING: Creating a duplicate database object for the same connection." +
12211224
EOL + stack + EOL;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pg-promise",
3-
"version": "4.7.0",
3+
"version": "4.7.1",
44
"description": "Promises interface for PostgreSQL",
55
"main": "lib/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)