sdepold/sequelize — pull request #298 by aslakhellesoy (2012-10-30 00:29:41+00:00)
Title: Pg pool

First off - thanks for a great library.

I wasn't happy with the current connection pooling support in the postgres dialect. I couldn't get #236 or #285 to work either. Here is a nother attempt at connection pooling for Postgres. It also simplifies the code a lot.

This implementation doesn't try to be smart about enqueing of queries. The `pg` driver's built-in pooling is much better at this. You want queuing? Use a pool. Let's not try to implement a half-arsed one in sequelize.

If the user does not specify a `pool`, a single `pg.Client` will be created.

BTW - I'm not sure the `ConnectorManager.connect` function should be part of the `ConnectorManager` contract. AFAICT it's only invoked from within a dialect. The sqlite dialect (doesn't override it). So I made it "private".

With this implementation you can also specify `uri` in the config instead of passing `db, user, password, host, port, protocol`. This is often a lot easier.

I haven't run the entire test suite (struggled a little to get all of them to run), so apologies if this breaks something. At least this passes for me:

```
DIALECT=postgres ./node_modules/.bin/buster-test -t spec/dao.spec.js
```

-both with and without a `pool` in `spec/config/config.js`.