0

From the docs it sounds like err is not null if there was a problem getting a client from the pool. If that's the case, does it mean done() doesn't need to be called?

pg.connect(connString, function(err, client, done){
    if (err) { done(); return err; }

    ...
});

or

pg.connect(connString, function(err, client, done){
    if (err) { return err; }

    ...
});
4

1 回答 1

1

您仅在成功done()时调用,即is或。connect()errnullundefined

所以第二个例子是正确的。

于 2015-04-24T22:09:34.543 回答