Skip to content

Commit 6f3112b

Browse files
committed
matching: default to concurrency 1.2 number of CPUs
This tries to reduce PostgreSQL idling due to a) some matching being done from the Redis cache and b) latency between Node.js and PostgreSQL.
1 parent 0b580f2 commit 6f3112b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/match.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const runGtfsMatching = async (cfg, opt = {}) => {
8484
// COPY cpu_cores (num_cores) FROM PROGRAM 'sysctl -n hw.ncpu';
8585
// SELECT num_cores FROM cpu_cores LIMIT 1
8686
// same as with hafas-gtfs-rt-feed: https://github.com/derhuerst/hafas-gtfs-rt-feed/blob/8.2.6/lib/match.js#L54-L61
87-
: osCpus().length + 1,
87+
: Math.ceil(1 + osCpus().length * 1.2),
8888
publishUnmatchedTripUpdates: process.env.MATCHING_PUBLISH_UNMATCHED_TRIPUPDATES
8989
? process.env.MATCHING_PUBLISH_UNMATCHED_TRIPUPDATES === 'true'
9090
: false,

0 commit comments

Comments
 (0)