mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 02:59:05 +08:00
fix: added safety checks for buildgraph functions and revert upgrades (#7215)
This commit is contained in:
parent
2f3cee814e
commit
52693eb53e
@ -250,10 +250,6 @@
|
|||||||
"body-parser": "1.20.3",
|
"body-parser": "1.20.3",
|
||||||
"http-proxy-middleware": "3.0.3",
|
"http-proxy-middleware": "3.0.3",
|
||||||
"cross-spawn": "7.0.5",
|
"cross-spawn": "7.0.5",
|
||||||
"cookie": "^0.7.1",
|
"cookie": "^0.7.1"
|
||||||
"react-router/path-to-regexp": "^1.7.0",
|
|
||||||
"webpack-dev-server/path-to-regexp": "^1.7.0",
|
|
||||||
"express/path-to-regexp": "^1.7.0",
|
|
||||||
"@types/webpack-dev-server/path-to-regexp": "^1.7.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ export const buildDependencyGraph = (
|
|||||||
Object.keys(dependencies).forEach((node) => {
|
Object.keys(dependencies).forEach((node) => {
|
||||||
if (!inDegree[node]) inDegree[node] = 0;
|
if (!inDegree[node]) inDegree[node] = 0;
|
||||||
if (!adjList[node]) adjList[node] = [];
|
if (!adjList[node]) adjList[node] = [];
|
||||||
dependencies[node].forEach((child) => {
|
dependencies[node]?.forEach((child) => {
|
||||||
if (!inDegree[child]) inDegree[child] = 0;
|
if (!inDegree[child]) inDegree[child] = 0;
|
||||||
inDegree[child]++;
|
inDegree[child]++;
|
||||||
adjList[node].push(child);
|
adjList[node].push(child);
|
||||||
@ -126,13 +126,13 @@ export const buildDependencyGraph = (
|
|||||||
}
|
}
|
||||||
topologicalOrder.push(current);
|
topologicalOrder.push(current);
|
||||||
|
|
||||||
adjList[current].forEach((neighbor) => {
|
adjList[current]?.forEach((neighbor) => {
|
||||||
inDegree[neighbor]--;
|
inDegree[neighbor]--;
|
||||||
if (inDegree[neighbor] === 0) queue.push(neighbor);
|
if (inDegree[neighbor] === 0) queue.push(neighbor);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topologicalOrder.length !== Object.keys(dependencies).length) {
|
if (topologicalOrder.length !== Object.keys(dependencies)?.length) {
|
||||||
console.error('Cycle detected in the dependency graph!');
|
console.error('Cycle detected in the dependency graph!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user