Skip to content

Commit 32f8f38

Browse files
azarzlgrdjrsalesMatthieu Proboeuftetram
authored
feat(valhalla): allow to configure exec timeout (#112)
* Merge doc/translate in develop (#107) * Test commit * test commit * test commit IDE * First draft on english documentation * Drafting the english doc * second draft of doc * Adding modifications from fr develop doc * corrections de coquilles sur les liens * corrections de coquilles sur les liens * update coquilles liens * test commit * test commit IDE * First draft on english documentation * second draft of doc * Adding modifications from fr develop doc * update coquilles liens * draft: main readme in english * fix: main readme test * fix typo test * fix : finish rebase * fix typo and switch to default french * fix readme for introduction --------- Co-authored-by: JRS <jeanroch.sales@gmail.com> * feat: handle exec maxBuffer size with environment variable * feat: update changelog * Changelog.md * Bump version in package.json * feat(valhalla): allow to configure exec timeout (#111) * feat(valhalla): allow to configure exec timeout * doc: add exec_tiemout description * doc: update changelog * Bump package.json --------- Co-authored-by: lgrd <lgrd@users.noreply.github.com> Co-authored-by: JRS <jeanroch.sales@gmail.com> Co-authored-by: Matthieu Proboeuf <matthieu.proboeuf@worldline.com> Co-authored-by: Aurelien <aurelien.clavelin@erizo.fr>
1 parent 93e9965 commit 32f8f38

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 2.2.8
4+
ADDED:
5+
- Valhalla: allow to configure a timeout on valhalla_service exec
6+
37
## 2.2.7
48
ADDED:
59
- Valhalla: Provide the ability to set maxBuffer in exec command options to avoid maxBuffer lenght exceeded error (#109)

documentation/production/readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,7 @@ Road2 peut être directement interrogé en HTTPS. Pour cela, il utilise le modul
7272

7373
Il est possible de changer la taille du buffer lors d'une source Valhalla en valorisant la variable d'environnement `EXEC_MAX_BUFFER_SIZE`.
7474
La valeur par défaut est de 1MB.
75+
76+
### Gestion du timeout valhalla
77+
Il est possible de changer la valeur du timeout d'execution du process valhalla_service en valorisant la variable d'environnement `EXEC_TIMEOUT` (nombre de millisecondes).
78+
La valeur par défaut est `0` soit pas de timeout.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "road2",
3-
"version": "2.2.7",
3+
"version": "2.2.8",
44
"description": "Calcul d'itinéraire",
55
"author": "RDEV - IGN",
66
"main": "src/js/road2.js",

src/js/sources/valhallaSource.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ const log4js = require('log4js');
1919
const LOGGER = log4js.getLogger("VALHALLASOURCE");
2020
// Récupération de la valeur du maxBuffer en variable d'environment variable ou valorisation par défaut (1MB)
2121
const maxBuffer = process.env.EXEC_MAX_BUFFER_SIZE ? parseInt(process.env.EXEC_MAX_BUFFER_SIZE, 10) : 1024 * 1024;
22+
// Récupération de la valeur du timeout pour l'execution du valhalla_service en variable d'environnement ou valorisation par défaut (0)
23+
const execTimeout = process.env.EXEC_TIMEOUT ? parseInt(process.env.EXEC_TIMEOUT, 10) : 0;
2224

2325
/**
2426
*
@@ -188,7 +190,7 @@ module.exports = class valhallaSource extends Source {
188190
// Permet de grandement se simplifier le parsing !!
189191
const optionsString = `"directions_options":{"format":"osrm"}`;
190192
const commandString = `valhalla_service ${this._configuration.storage.config} route '{${locationsString},${costingString},${optionsString}}' `;
191-
const options = { maxBuffer: maxBuffer };
193+
const options = { maxBuffer: maxBuffer, timeout: execTimeout };
192194
LOGGER.info(commandString);
193195

194196
return new Promise( (resolve, reject) => {
@@ -290,7 +292,7 @@ module.exports = class valhallaSource extends Source {
290292
const reverseString = `"reverse":${reverse}`;
291293
const polygonsString = `"polygons":true`;
292294
const commandString = `valhalla_service ${this._configuration.storage.config} isochrone '{${locationsString},${costingString},${costingOptionsString},${contoursString},${reverseString},${polygonsString}}' `;
293-
const options = { maxBuffer: maxBuffer };
295+
const options = { maxBuffer: maxBuffer, timeout: execTimeout };
294296
LOGGER.info(commandString);
295297

296298
return new Promise( (resolve, reject) => {

0 commit comments

Comments
 (0)