diff --git a/lib/stoptimes/StopTimes2Cxs.js b/lib/stoptimes/StopTimes2Cxs.js index ed19a86..3d50d91 100644 --- a/lib/stoptimes/StopTimes2Cxs.js +++ b/lib/stoptimes/StopTimes2Cxs.js @@ -53,18 +53,20 @@ module.exports = function (sourcePath, outPath, stores, fresh) { printedRows++; }); - connectionRules.on('end', () => { + connectionRules.on('end', async () => { for (let i in connectionsPool) { connectionsPool[i].end(); } // Close all LevelDB stores as they will not be used any further on this process if (!(stores.stopsDB instanceof Map)) { - stores.stopsDB.close(); - stores.tripsDB.close(); - stores.routesDB.close(); - stores.servicesDB.close(); - historyDB.close(); + await Promise.all([ + stores.stopsDB.close(), + stores.tripsDB.close(), + stores.routesDB.close(), + stores.servicesDB.close(), + historyDB.close() + ]); } console.error(`Created ${printedRows} Connection rules in ${new Date() - t0} ms`); diff --git a/lib/stoptimes/st2c.js b/lib/stoptimes/st2c.js index 66296ad..a991be5 100644 --- a/lib/stoptimes/st2c.js +++ b/lib/stoptimes/st2c.js @@ -128,11 +128,7 @@ // Update history with new found service dates const update = Object.assign({}, old); newServices.forEach(nsd => { - update[nsd] = { - type: 'Connection', - departureDelay: 0, - arrivalDelay: 0 - } + update[nsd] = { type: 'Connection' }; }); await this.historyDB.put(id, update);