Пример #1
0
    def send(self, *msgs: dict) -> None:
        """Schedule a message for sending to the other side

        This completes quickly and synchronously
        """
        if self.comm is not None and self.comm.closed():
            raise CommClosedError(f"Comm {self.comm!r} already closed.")

        self.message_count += len(msgs)
        self.buffer.extend(msgs)
        # Avoid spurious wakeups if possible
        if self.next_deadline is None:
            self.waker.set()
Пример #2
0
 def bad_heartbeat_worker(*args, **kwargs):
     raise CommClosedError()
Пример #3
0
 async def wait_and_raise(*args, **kwargs):
     async with lock:
         raise CommClosedError()