Skip to content

Commit 3f44817

Browse files
mateczaganygyfora
authored andcommitted
[FLINK-38051] Fix flaky test JobAutoScalerImplTest
1 parent 8812c78 commit 3f44817

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

flink-autoscaler/src/main/java/org/apache/flink/autoscaler/ScalingMetricEvaluator.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,10 @@ public static double getRate(
456456
return Double.NaN;
457457
}
458458

459-
return 1000 * (last - first) / Duration.between(firstTs, lastTs).toMillis();
459+
long tsDiff = Duration.between(firstTs, lastTs).toMillis();
460+
tsDiff = Math.max(tsDiff, 1);
461+
462+
return 1000 * (last - first) / tsDiff;
460463
}
461464

462465
public static double getAverage(

0 commit comments

Comments
 (0)