From de6aa0ac012b2c928be24db234fa974d51e5649a Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 15 Sep 2015 23:20:10 +0100 Subject: Improve database connection handling --- create-data.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/create-data.js b/create-data.js index 1e62d2d..0c9a76f 100755 --- a/create-data.js +++ b/create-data.js @@ -29,7 +29,7 @@ pgql.connect('tcp://' + config.user + ':' + config.password + '@' + config.server + ':' + config.port + '/' + - config.database, function(err, client) { + config.database, function(err, client, done) { if (err) { console.error(err); return; @@ -145,11 +145,12 @@ pgql.connect('tcp://' + config.user + ':' + function(err, collections){ if (err) { console.error(err); + console.error("Failed to create data.json"); process.exit(1); } console.info("ending database connection"); - pgql.end(); + done(); writeDataFiles(collections, function() { Object.keys(validationByURI).sort().forEach(function(uri) { -- cgit v1.2.3