import pymizu
with pymizu.Channel.create('''
import pymizu
while True:
x = ch.recv()
if x is pymizu.CLOSED:
break
ch.send(x)
''') as ch:
ch.send_batch([1, 2, 3])
batch = await ch.recv_batch_async()
batch[1, 2, 3]
Return an asyncio.Future for a list of received values.
Usage
n: int = 256 An asyncio.Future resolving with a list of up to n values inCLOSED / PEER_GONE sentinel. An n past the drain quantum (2048) resolves with at most one quantum per pass.
ValueErrorn is less than 1.
ConcurrentUseErrorSingle and batch waiters on one channel resolve in call order. A batch waiter takes up to its n values from the available burst. It takes at least one value when reached, so a batch reached late in a busy pass can resolve short.
Cancellation, timeouts, spin=True, and consumer exclusion follow recv_async().
A declined foreign payload ahead of a batch resolves it short with the preceding values. The waiter that reaches the declined message rejects with ForeignPayloadError. Later waiters are unaffected.