diff --git a/.github/workflows/osrm-backend.yml b/.github/workflows/osrm-backend.yml index df5eb215077..c43ad5e43fb 100644 --- a/.github/workflows/osrm-backend.yml +++ b/.github/workflows/osrm-backend.yml @@ -75,6 +75,7 @@ jobs: CXXCOMPILER: g++-9 ENABLE_SANITIZER: ON TARGET_ARCH: x86_64-asan-ubsan + OSRM_CONNECTION_RETRIES: 30 - name: clang-5.0-debug continue-on-error: false diff --git a/features/lib/osrm_loader.js b/features/lib/osrm_loader.js index a29d53b8e33..7cb719fc5b8 100644 --- a/features/lib/osrm_loader.js +++ b/features/lib/osrm_loader.js @@ -45,11 +45,11 @@ class OSRMBaseLoader{ var retryCount = 0; let retry = (err) => { if (err) { - if (retryCount < 10) { + if (retryCount < this.scope.OSRM_CONNECTION_RETRIES) { retryCount++; setTimeout(() => { tryConnect(this.scope.OSRM_IP, this.scope.OSRM_PORT, retry); }, 10); } else { - callback(new Error("Could not connect to osrm-routed after ten retries.")); + callback(new Error(`Could not connect to osrm-routed after ${this.scope.OSRM_CONNECTION_RETRIES} retries.`)); } } else diff --git a/features/support/env.js b/features/support/env.js index 95ddf3370c3..90909b55b8a 100644 --- a/features/support/env.js +++ b/features/support/env.js @@ -40,6 +40,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 || 10; this.HOST = `http://${this.OSRM_IP}:${this.OSRM_PORT}`; this.OSRM_PROFILE = process.env.OSRM_PROFILE;