Closing postgres (pg) client connection in node.js
问题 I have a script that I want to run on a scheduled basis in node. The script is not terminating and exiting. I suspect that this is because my database client is still open. var client = new pg.Client(conString); client.connect(); function registerBundle (innerHash, outterHash) { // some stuff here } var query = client.query("SELECT id, chain FROM mytable where \ state_ready = true and transaction_id='' "); query.on('row', function(row) { var chain = row['chain']; var pg_record = row['id'];