Example #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()
Example #2
0
 def bad_heartbeat_worker(*args, **kwargs):
     raise CommClosedError()
Example #3
0
 async def wait_and_raise(*args, **kwargs):
     async with lock:
         raise CommClosedError()