Browse Source

Fix small bug in math if target is full.

master
rewby 8 months ago
parent
commit
fe2c9c2d0f
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      cmd/dispatcher/state.go

+ 5
- 2
cmd/dispatcher/state.go View File

@@ -188,8 +188,11 @@ func (state *State) UpdateThread() {
inflightsSum := int64(0)
inflightsCount := 0
for _, t := range targets {
inflightsSum = inflightsSum + t.Inflight
inflightsCount = inflightsCount + 1
// Only count targets that can actually handle inbound in this calculation.
if t.FreeSpace > int64(t.Target.MinimumFreeSpace) {
inflightsSum = inflightsSum + t.Inflight
inflightsCount = inflightsCount + 1
}
}
averageInflights := float64(inflightsSum) / float64(inflightsCount)
log.Debugf("Average inflights: %v", averageInflights)


Loading…
Cancel
Save