Переглянути джерело

Fix nans in calculating balance quality

Aleksandr Borzunov 2 роки тому
батько
коміт
ae4657ddec
1 змінених файлів з 3 додано та 0 видалено
  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}%")