From 4592a215bd28c1ae9ea8921cb20600aa11087355 Mon Sep 17 00:00:00 2001 From: Julian Rojas Date: Fri, 8 Jul 2022 13:27:18 +0200 Subject: [PATCH 1/2] Do not set delays on historic records adn properly close LevelDBs --- lib/stoptimes/StopTimes2Cxs.js | 14 ++++++++------ lib/stoptimes/st2c.js | 6 +----- 2 files changed, 9 insertions(+), 11 deletions(-) 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); From 1c617ca2956e252b0e54d59b1f1a95e3738b8d6a Mon Sep 17 00:00:00 2001 From: Julian Rojas Date: Fri, 8 Jul 2022 13:28:53 +0200 Subject: [PATCH 2/2] 2.1.4 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4faa6f7..d73c811 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gtfs2lc", - "version": "2.1.3", + "version": "2.1.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "gtfs2lc", - "version": "2.1.3", + "version": "2.1.4", "license": "MIT", "dependencies": { "commander": "^4.1.1", diff --git a/package.json b/package.json index fc2cbd8..b81bfe9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gtfs2lc", - "version": "2.1.3", + "version": "2.1.4", "description": "Mapping script from gtfs to (linked) connections", "main": "lib/gtfs2lc.js", "bin": {