From 32f1d28eca16cc814a7867765a0db10ab3ef0f5f Mon Sep 17 00:00:00 2001 From: jkaplon Date: Tue, 2 Feb 2016 08:28:05 -0500 Subject: [PATCH] Add done() calls to post handler so connection is returned to pool. Trying to fix 504 timeout errors from nginx. Initial testing looks good. --- server.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server.js b/server.js index 179aa1f..1e6f768 100644 --- a/server.js +++ b/server.js @@ -91,6 +91,7 @@ app.post('/', function(req, res){ "INSERT INTO alerts (origjson, coreid, published_at, status) VALUES ($1, $2, $3, $4);", [JSON.stringify(req.body, null, 4), coreid, pubAt, status] ); + done(); }); } else { // parse for minimal data from cell modem. var deviceid = JSON.stringify(req.body.data, null, 4).slice(1,4); @@ -112,6 +113,7 @@ app.post('/', function(req, res){ "INSERT INTO alerts (origjson, coreid, published_at, status) VALUES ($1, $2, $3, $4);", [JSON.stringify(req.body, null, 4), deviceid, received_at, statusFromCode] ); + done(); }); } res.status(204).send('POST received');