Skip to content

Commit 6127b59

Browse files
fix(trends): add defensive check for division by zero in throughput calculation
1 parent bf74930 commit 6127b59

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Services/TrendAnalysisService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ public function analyzeThroughputTrend(
175175
$avg = array_sum($throughputs) / $count;
176176
$totalJobs = array_sum($throughputs);
177177

178-
// Calculate jobs per minute
179-
$jobsPerMinute = ($totalJobs / $periodSeconds) * 60;
178+
// Calculate jobs per minute (with defensive division by zero check)
179+
$jobsPerMinute = $periodSeconds > 0 ? ($totalJobs / $periodSeconds) * 60 : 0.0;
180180

181181
// Trend analysis
182182
$trend = $this->calculateLinearTrend($values);

0 commit comments

Comments
 (0)