brianc/node-libpq — pull request #7 by brianc (2014-12-16 03:51:07+00:00)
Title: Fix #Ref() & #Unref() usage

There were scenarios under heavy memory pressure where the connection would
be connected in the midst of doing work because the #Ref() was released
after each query. This changes the behavior to hold a #Ref() to the object
-- and prevent garbage collection -- for as long as there is an open
connection to the backend. This prevents a bunch of weird, tricky
race-conditions, cleans up the code, and brings it in-line with how other
sockets behave. It properly blocks the event-loop until it's cleaned up.