Skip to content

Commit f05a357

Browse files
Merge pull request #351 from commercetools/fix-benchmark-first-time
Return 0 if there is no previous avg benchmarks.
2 parents 7187018 + de9ef09 commit f05a357

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/benchmark/java/com/commercetools/sync/benchmark/BenchmarkUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@ private static double calculateDiff(@Nonnull final JsonNode originalRoot,
153153
.get(benchmark)
154154
.get(AVERAGE))
155155
.map(latestAverageNode -> average - latestAverageNode.asDouble())
156-
// if there is no latest version - the current average is the diff.
157-
.orElse(average);
156+
// if there is no latest version (meaning this is the first benchmark for this module)
157+
// then return a 0 diff.
158+
.orElse(0.0);
158159
}
159160

160161
private static Optional<String> getLatestVersionName(@Nonnull final JsonNode originalRoot,

0 commit comments

Comments
 (0)