forked from goodboy/tractor
1
0
Fork 0

Add back in async gen loop

310_plus
Tyler Goodlet 2022-02-16 13:59:23 -05:00
parent dbc689d55a
commit 1822d0b48b
1 changed files with 8 additions and 9 deletions

View File

@ -6,6 +6,7 @@ async def gen():
yield 'yo' yield 'yo'
await tractor.breakpoint() await tractor.breakpoint()
yield 'yo' yield 'yo'
await tractor.breakpoint()
@tractor.context @tractor.context
@ -13,14 +14,17 @@ async def just_bp(
ctx: tractor.Context, ctx: tractor.Context,
) -> None: ) -> None:
await ctx.started('yo bpin here') await ctx.started()
await tractor.breakpoint() await tractor.breakpoint()
# TODO: bps and errors in this call.. # TODO: bps and errors in this call..
# async for val in gen(): async for val in gen():
# print(val) print(val)
await trio.sleep(0.5) # await trio.sleep(0.5)
# prematurely destroy the connection
await ctx.chan.aclose()
# THIS CAUSES AN UNRECOVERABLE HANG # THIS CAUSES AN UNRECOVERABLE HANG
# without latest ``pdbpp``: # without latest ``pdbpp``:
@ -30,20 +34,15 @@ async def just_bp(
async def main(): async def main():
async with tractor.open_nursery( async with tractor.open_nursery(
# loglevel='transport',
debug_mode=True, debug_mode=True,
) as n: ) as n:
p = await n.start_actor( p = await n.start_actor(
'bp_boi', 'bp_boi',
enable_modules=[__name__], enable_modules=[__name__],
# debug_mode=True,
) )
async with p.open_context( async with p.open_context(
just_bp, just_bp,
) as (ctx, first): ) as (ctx, first):
# await tractor.breakpoint()
# breakpoint()
await trio.sleep_forever() await trio.sleep_forever()