@routr/location 2.0.8-alpha.11 → 2.0.8-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,7 +46,7 @@ exports.getConfig = void 0;
46
46
  * limitations under the License.
47
47
  */
48
48
  const types_1 = require("../types");
49
- const fs_1 = __importDefault(require("fs"));
49
+ const common_1 = require("@routr/common");
50
50
  const schema_1 = require("./schema");
51
51
  const ajv_1 = __importDefault(require("ajv"));
52
52
  const E = __importStar(require("fp-ts/Either"));
@@ -59,7 +59,7 @@ const hasBadAlgorithm = (backends) => backends.some((b) => b.balancingAlgorithm
59
59
  b.balancingAlgorithm !== types_1.LoadBalancingAlgorithm.LEAST_SESSIONS);
60
60
  const getConfig = (path) => {
61
61
  var _a, _b, _c;
62
- const c = JSON.parse(fs_1.default.readFileSync(path, "utf8"));
62
+ const c = common_1.Helper.readConfigFile(path);
63
63
  if (!validate(Object.assign({}, c))) {
64
64
  return E.left(new errors_1.InvalidSchemaConfiguration(JSON.stringify(validate.errors[0].message)));
65
65
  }
package/dist/location.js CHANGED
@@ -81,7 +81,9 @@ class Location {
81
81
  throw new errors_1.NotRoutesFoundForAOR(request.aor);
82
82
  }
83
83
  // If it has not affinity sesssion then get next
84
- const r = backend.withSessionAffinity
84
+ const r =
85
+ // Falls back to round-robin if no session affinity ref is provided
86
+ backend.withSessionAffinity && request.sessionAffinityRef
85
87
  ? [yield this.nextWithAffinity(routes, request.sessionAffinityRef)]
86
88
  : [this.next(routes, backend)];
87
89
  // Next time we will get the route with callId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routr/location",
3
- "version": "2.0.8-alpha.11",
3
+ "version": "2.0.8-alpha.13",
4
4
  "description": "Creates and maintains a list of routes to all registered endpoints",
5
5
  "author": "Pedro Sanders <psanders@fonoster.com>",
6
6
  "homepage": "https://github.com/fonoster/routr#readme",
@@ -35,8 +35,8 @@
35
35
  "@opentelemetry/sdk-trace-base": "^1.0.4",
36
36
  "@opentelemetry/sdk-trace-node": "^1.0.4",
37
37
  "@opentelemetry/semantic-conventions": "^1.0.4",
38
- "@routr/common": "^2.0.8-alpha.11",
39
- "@routr/processor": "^2.0.8-alpha.11",
38
+ "@routr/common": "^2.0.8-alpha.13",
39
+ "@routr/processor": "^2.0.8-alpha.13",
40
40
  "ajv": "^6.12.6",
41
41
  "fp-ts": "^2.11.8",
42
42
  "redis": "^4.0.4"
@@ -48,5 +48,5 @@
48
48
  "bugs": {
49
49
  "url": "https://github.com/fonoster/routr/issues"
50
50
  },
51
- "gitHead": "627659ac51d0814a3106bcaac31a15c581a5809f"
51
+ "gitHead": "d866d6c03c5ea7e8fc3ee074804005df3a5be42f"
52
52
  }