Skip to content

Commit

Permalink
Merge pull request #1544 from snyk/fix/add-prune-duration
Browse files Browse the repository at this point in the history
fix: add graph conversion while pruning duration analytics
  • Loading branch information
orsagie committed Dec 9, 2020
2 parents 4b7ab8a + 0894113 commit 420c95d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib/prune.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,17 @@ export async function pruneGraph(
analytics.add('prePrunedPathsCount', prePrunePathsCount);
if (isDenseGraph || pruneIsRequired) {
debug('Trying to prune the graph');
const pruneStartTime = Date.now();
const prunedTree = (await graphToDepTree(depGraph, packageManager, {
deduplicateWithinTopLevelDeps: true,
})) as DepTree;
const graphToTreeEndTime = Date.now();
analytics.add(
'prune.graphToTreeDuration',
graphToTreeEndTime - pruneStartTime,
);
const prunedGraph = await depTreeToGraph(prunedTree, packageManager);
analytics.add('prune.treeToGraphDuration', Date.now() - graphToTreeEndTime);
const postPrunePathsCount = countPathsToGraphRoot(prunedGraph);
analytics.add('postPrunedPathsCount', postPrunePathsCount);
debug('postPrunePathsCount' + postPrunePathsCount);
Expand Down

0 comments on commit 420c95d

Please sign in to comment.