Adjust remaining examples and tests for non-backpressure default
parent
2b05ffcc23
commit
7b9d410c4d
|
@ -7,7 +7,7 @@ import tractor
|
||||||
async def stream_data(seed):
|
async def stream_data(seed):
|
||||||
for i in range(seed):
|
for i in range(seed):
|
||||||
yield i
|
yield i
|
||||||
await trio.sleep(0) # trigger scheduler
|
await trio.sleep(0.0001) # trigger scheduler
|
||||||
|
|
||||||
|
|
||||||
# this is the third actor; the aggregator
|
# this is the third actor; the aggregator
|
||||||
|
|
|
@ -386,7 +386,8 @@ async def cancel_self(
|
||||||
|
|
||||||
@tractor_test
|
@tractor_test
|
||||||
async def test_callee_cancels_before_started():
|
async def test_callee_cancels_before_started():
|
||||||
'''callee calls `Context.cancel()` while streaming and caller
|
'''
|
||||||
|
Callee calls `Context.cancel()` while streaming and caller
|
||||||
sees stream terminated in `ContextCancelled`.
|
sees stream terminated in `ContextCancelled`.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
@ -420,9 +421,10 @@ async def simple_rpc(
|
||||||
data: int,
|
data: int,
|
||||||
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test a small ping-pong server.
|
'''
|
||||||
|
Test a small ping-pong server.
|
||||||
|
|
||||||
"""
|
'''
|
||||||
# signal to parent that we're up
|
# signal to parent that we're up
|
||||||
await ctx.started(data + 1)
|
await ctx.started(data + 1)
|
||||||
|
|
||||||
|
@ -480,9 +482,10 @@ async def simple_rpc_with_forloop(
|
||||||
[simple_rpc, simple_rpc_with_forloop],
|
[simple_rpc, simple_rpc_with_forloop],
|
||||||
)
|
)
|
||||||
def test_simple_rpc(server_func, use_async_for):
|
def test_simple_rpc(server_func, use_async_for):
|
||||||
"""The simplest request response pattern.
|
'''
|
||||||
|
The simplest request response pattern.
|
||||||
|
|
||||||
"""
|
'''
|
||||||
async def main():
|
async def main():
|
||||||
async with tractor.open_nursery() as n:
|
async with tractor.open_nursery() as n:
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ async def stream_data(seed):
|
||||||
yield i
|
yield i
|
||||||
|
|
||||||
# trigger scheduler to simulate practical usage
|
# trigger scheduler to simulate practical usage
|
||||||
await trio.sleep(0)
|
await trio.sleep(0.0001)
|
||||||
|
|
||||||
|
|
||||||
# this is the third actor; the aggregator
|
# this is the third actor; the aggregator
|
||||||
|
|
|
@ -83,7 +83,7 @@ async def open_sequence_streamer(
|
||||||
) as (ctx, first):
|
) as (ctx, first):
|
||||||
|
|
||||||
assert first is None
|
assert first is None
|
||||||
async with ctx.open_stream() as stream:
|
async with ctx.open_stream(backpressure=True) as stream:
|
||||||
yield stream
|
yield stream
|
||||||
|
|
||||||
await portal.cancel_actor()
|
await portal.cancel_actor()
|
||||||
|
|
Loading…
Reference in New Issue