Implement NodeJS based server fully replicating osrm-routed
This commit is contained in:
@@ -15,6 +15,8 @@ module.exports = function () {
|
||||
this.setDefaultTimeout(this.TIMEOUT);
|
||||
this.ROOT_PATH = process.cwd();
|
||||
|
||||
this.USE_ROUTED_JS = process.env.OSRM_USE_ROUTED_JS || false;
|
||||
|
||||
this.TEST_PATH = path.resolve(this.ROOT_PATH, 'test');
|
||||
this.CACHE_PATH = path.resolve(this.TEST_PATH, 'cache');
|
||||
this.LOGS_PATH = path.resolve(this.TEST_PATH, 'logs');
|
||||
@@ -40,7 +42,7 @@ module.exports = function () {
|
||||
|
||||
this.OSRM_PORT = process.env.OSRM_PORT && parseInt(process.env.OSRM_PORT) || 5000;
|
||||
this.OSRM_IP = process.env.OSRM_IP || '127.0.0.1';
|
||||
this.OSRM_CONNECTION_RETRIES = process.env.OSRM_CONNECTION_RETRIES && parseInt(process.env.OSRM_CONNECTION_RETRIES) || 10;
|
||||
this.OSRM_CONNECTION_RETRIES = process.env.OSRM_CONNECTION_RETRIES && parseInt(process.env.OSRM_CONNECTION_RETRIES) || 100;
|
||||
this.OSRM_CONNECTION_EXP_BACKOFF_COEF = process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF && parseFloat(process.env.OSRM_CONNECTION_EXP_BACKOFF_COEF) || 1.0;
|
||||
|
||||
this.HOST = `http://${this.OSRM_IP}:${this.OSRM_PORT}`;
|
||||
|
||||
@@ -39,7 +39,11 @@ module.exports = function () {
|
||||
|
||||
this.runBin = (bin, options, env, callback) => {
|
||||
let cmd = path.resolve(util.format('%s/%s%s', this.BIN_PATH, bin, this.EXE));
|
||||
if (this.USE_ROUTED_JS && bin === 'osrm-routed') {
|
||||
cmd = 'osrm-routed-js';
|
||||
}
|
||||
let opts = options.split(' ').filter((x) => { return x && x.length > 0; });
|
||||
|
||||
let log = fs.createWriteStream(this.scenarioLogFile, {'flags': 'a'});
|
||||
log.write(util.format('*** running %s %s\n', cmd, options));
|
||||
// we need to set a large maxbuffer here because we have long running processes like osrm-routed
|
||||
|
||||
Reference in New Issue
Block a user