Skip to content

Commit

Permalink
Small fixes for osrm-runner
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarex committed May 31, 2017
1 parent 9f5515a commit 3d19212
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scripts/osrm-runner.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/usr/bin/env node

'use strict';

const fs = require('fs');
const http = require('http');
const process = require('process');
const cla = require('command-line-args');
const clu = require('command-line-usage');
const ansi = require('ansi-escape-sequences');
const turf = require('turf');
const util = require('util');
const jp = require('jsonpath');

const run_query = (query_options, filters, callback) => {
let tic = () => 0.;
let req = http.request(query_options, function (res) {
http.request(query_options, function (res) {
let body = '', ttfb = tic();
if (res.statusCode != 200)
return callback(query_options.path, res.statusCode, ttfb);
Expand All @@ -27,12 +28,12 @@ const run_query = (query_options, filters, callback) => {
Promise.all(filters.map(filter => jp.query(json, filter)))
.then(values => callback(query_options.path, res.statusCode, ttfb, elapsed, values));
});
}).on('socket', function (res) {
}).on('socket', function (/*res*/) {
tic = ((toc) => { return () => process.hrtime(toc)[1] / 1000000; })(process.hrtime());
}).on('error', function (res) {
callback(query_options.path, res.code);
}).end();
}
};

function generate_points(polygon, number) {
let query_points = [];
Expand Down

0 comments on commit 3d19212

Please sign in to comment.