Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #113

Merged
merged 9 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 2.2.8
ADDED:
- Valhalla: allow to configure a timeout on valhalla_service exec

## 2.2.7
ADDED:
- Valhalla: Provide the ability to set maxBuffer in exec command options to avoid maxBuffer lenght exceeded error (#109)
Expand Down
4 changes: 4 additions & 0 deletions documentation/production/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,7 @@ Road2 peut être directement interrogé en HTTPS. Pour cela, il utilise le modul

Il est possible de changer la taille du buffer lors d'une source Valhalla en valorisant la variable d'environnement `EXEC_MAX_BUFFER_SIZE`.
La valeur par défaut est de 1MB.

### Gestion du timeout valhalla
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).
La valeur par défaut est `0` soit pas de timeout.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "road2",
"version": "2.2.7",
"version": "2.2.8",
"description": "Calcul d'itinéraire",
"author": "RDEV - IGN",
"main": "src/js/road2.js",
Expand Down
6 changes: 4 additions & 2 deletions src/js/sources/valhallaSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const log4js = require('log4js');
const LOGGER = log4js.getLogger("VALHALLASOURCE");
// Récupération de la valeur du maxBuffer en variable d'environment variable ou valorisation par défaut (1MB)
const maxBuffer = process.env.EXEC_MAX_BUFFER_SIZE ? parseInt(process.env.EXEC_MAX_BUFFER_SIZE, 10) : 1024 * 1024;
// Récupération de la valeur du timeout pour l'execution du valhalla_service en variable d'environnement ou valorisation par défaut (0)
const execTimeout = process.env.EXEC_TIMEOUT ? parseInt(process.env.EXEC_TIMEOUT, 10) : 0;

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

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

return new Promise( (resolve, reject) => {
Expand Down
Loading