return Future from async send()
to *optionally* wait for it to hit the wire
This commit is contained in:
parent
e470d57780
commit
2a9d658207
1 changed files with 5 additions and 4 deletions
|
@ -34,12 +34,13 @@ class Server(IServer):
|
|||
self._read_queue: Queue[Tuple[Line, List[Emit]]] = Queue()
|
||||
self.desired_caps: Set[ICapability] = set([])
|
||||
|
||||
async def send_raw(self, line: str, priority=SendPriority.DEFAULT):
|
||||
await self.send(tokenise(line), priority)
|
||||
async def send(self, line: Line, priority=SendPriority.DEFAULT):
|
||||
async def send_raw(self, line: str, priority=SendPriority.DEFAULT
|
||||
) -> Future:
|
||||
return await self.send(tokenise(line), priority)
|
||||
async def send(self, line: Line, priority=SendPriority.DEFAULT) -> Future:
|
||||
prio_line = SentLine(priority, line)
|
||||
await self._write_queue.put(prio_line)
|
||||
await prio_line.future
|
||||
prio_line.future
|
||||
|
||||
def set_throttle(self, rate: int, time: float):
|
||||
self.throttle.rate_limit = rate
|
||||
|
|
Loading…
Reference in a new issue