tgriesser/knex — pull request #193 by xaka (2014-02-28 19:56:29+00:00)
Title: play nicely with node.js domains

Long story short. When you create a connection it's added to an active domain. When you close a connection, it's removed from a domain. It works well and expected in a situation not involving a connection pool.

Now, with a connection pool, create and close become acquire and release, and a connection has a longer life which is managed by a connection pool. Every time you acquire a connection from a connection pool, a domain, previously assigned to it when it was created, is out-of-date, because at the time you acquire a connection, an active domain is different and you must re-assign it to a connection. That means a connection pool has to manage domains for us. It's not that difficult though.