Explorar el Código

Revert removing of `if not self._inner_pipe.poll():`

Aleksandr Borzunov hace 2 años
padre
commit
096117046d
Se han modificado 2 ficheros con 4 adiciones y 0 borrados
  1. 2 0
      hivemind/averaging/averager.py
  2. 2 0
      hivemind/dht/dht.py

+ 2 - 0
hivemind/averaging/averager.py

@@ -306,6 +306,8 @@ class DecentralizedAverager(mp.Process, ServicerBase):
 
             while True:
                 await pipe_semaphore.acquire()
+                if not self._inner_pipe.poll():
+                    continue
                 try:
                     method, args, kwargs = self._inner_pipe.recv()
                 except (OSError, ConnectionError, RuntimeError) as e:

+ 2 - 0
hivemind/dht/dht.py

@@ -120,6 +120,8 @@ class DHT(mp.Process):
 
             while True:
                 await pipe_semaphore.acquire()
+                if not self._inner_pipe.poll():
+                    continue
                 try:
                     method, args, kwargs = self._inner_pipe.recv()
                 except (OSError, ConnectionError, RuntimeError) as e: