Jelajahi Sumber

Fix nans in calculating balance quality

Aleksandr Borzunov 2 tahun lalu
induk
melakukan
ae4657ddec
1 mengubah file dengan 3 tambahan dan 0 penghapusan
  1. 3 0
      src/server/block_selection.py

+ 3 - 0
src/server/block_selection.py

@@ -106,6 +106,9 @@ def should_choose_other_blocks(
             throughputs[span.start : span.end] += span.throughput
 
     new_throughput = throughputs.min()
+    if new_throughput < initial_throughput or new_throughput < eps:
+        return False
+
     actual_quality = initial_throughput / new_throughput
     logger.info(f"Swarm balance quality: {actual_quality * 100:.1f}%")