Don't shut down if didn't talk much before

This commit is contained in:
Casey 2024-07-07 21:37:21 +03:00
parent 557ff002b0
commit c99e150fff
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 4 additions and 1 deletions

View File

@ -39,6 +39,7 @@ class AsyncBotManager:
self._written_boxes = 0
self._read_boxes = 0
self._last_printout = time_now()
self._n_printouts = 0
self._active: set[int] = set()
self.reader_event = asyncio.Event()
@ -199,11 +200,13 @@ class AsyncBotManager:
print(f"I/O: {incoming:7.2f}/s | {outgoing:7.2f}/s")
print(f"Alive workers: {len(self._active)}")
if len(self._active) < 2:
if len(self._active) < 2 and self._n_printouts > 3:
print("Too few workers, dying!")
self._shutdown = True
return
self._n_printouts += 1
n_correct, n_wrong = 0, 0
for index, expected in self.difference.items():
y, x = divmod(index, 1000)