소스 검색

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}%")