Skip to content

Commit de9ef09

Browse files
committed
Return 0 if there is no previous avg benchmarks.
1 parent 7187018 commit de9ef09

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)