balderdashy/sails-postgresql — pull request #14 by polastre (2013-08-10 19:10:39+00:00)
Title: Fix adapter.define callbacks to prevent deadlock.

adapter.define and adapter.describe both try spawnConnection,
but adapter.define consumes all of the instances in the
pool (10, by default, in node-postgres) and thus the
adapter.describe function called at the end of adapter.define
results in deadlock (with very nasty effects to your database)

This is a MAJOR show stopper bug.

Recommendation for future code refactoring: don't call every callback `cb`, because it makes it very difficult to determine which callback is in scope and which one has been called.