Fix regression in GPN heuristic
This commit is contained in:
1 parent
1c9aa493c6
commit
f57bcae70c
2 files changed
+10
-5
No files matched your search
@@ -1,3 +1,5 @@
|
|||||||
|
import Path from "./common/path";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copyright 2013-2019 GenieACS Inc.
|
* Copyright 2013-2019 GenieACS Inc.
|
||||||
*
|
*
|
||||||
@@ -27,9 +29,12 @@ const UNDISCOVERED_DEPTH = 7;
|
|||||||
// flags is an int where its bits mark the segments in the pattern that
|
// flags is an int where its bits mark the segments in the pattern that
|
||||||
// need refreshing. Leading 0s indicate that the pattern up to that
|
// need refreshing. Leading 0s indicate that the pattern up to that
|
||||||
// point has been discovered.
|
// point has been discovered.
|
||||||
export function estimateGpnCount(gpnPatterns, depth = 0): number {
|
export function estimateGpnCount(
|
||||||
const children = {};
|
gpnPatterns: [Path, number][],
|
||||||
const wildcardChildren = [];
|
depth: number = 0
|
||||||
|
): number {
|
||||||
|
const children: { [segment: string]: [Path, number][] } = {};
|
||||||
|
const wildcardChildren: [Path, number][] = [];
|
||||||
let wildcardDiscovered = false;
|
let wildcardDiscovered = false;
|
||||||
let gpnCount = 0;
|
let gpnCount = 0;
|
||||||
|
|
||||||
@@ -37,7 +42,7 @@ export function estimateGpnCount(gpnPatterns, depth = 0): number {
|
|||||||
const path = pattern[0];
|
const path = pattern[0];
|
||||||
const flags = pattern[1] >> depth;
|
const flags = pattern[1] >> depth;
|
||||||
|
|
||||||
const k = path[depth];
|
const k = path.segments[depth] as string;
|
||||||
|
|
||||||
if (!k) {
|
if (!k) {
|
||||||
if (flags & 1) gpnCount = 1;
|
if (flags & 1) gpnCount = 1;
|
||||||
|
|||||||
+1
-1
@@ -1525,7 +1525,7 @@ function generateGetRpcRequest(sessionContext: SessionContext): GetAcsRequest {
|
|||||||
let nextLevel;
|
let nextLevel;
|
||||||
let est = 0;
|
let est = 0;
|
||||||
if (path.length >= GPN_NEXT_LEVEL) {
|
if (path.length >= GPN_NEXT_LEVEL) {
|
||||||
const patterns = [[path, 0]];
|
const patterns: [Path, number][] = [[path, 0]];
|
||||||
for (const p of sessionContext.deviceData.paths.find(
|
for (const p of sessionContext.deviceData.paths.find(
|
||||||
path,
|
path,
|
||||||
true,
|
true,
|
||||||
|
|||||||
Reference in new issue
Block a user