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