summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <cb15g11@soton.ac.uk>2015-09-15 23:20:10 +0100
committerChristopher Baines <cb15g11@soton.ac.uk>2015-09-15 23:20:10 +0100
commitde6aa0ac012b2c928be24db234fa974d51e5649a (patch)
treea10d7cdea2cab6fe6cc4d12332139f0621dc509b
parent58a084cf5a1029f2d516529eeacd6584b983e56a (diff)
downloadleaflet-soton-de6aa0ac012b2c928be24db234fa974d51e5649a.tar
leaflet-soton-de6aa0ac012b2c928be24db234fa974d51e5649a.tar.gz
Improve database connection handling
-rwxr-xr-xcreate-data.js5
1 files 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) {