forked from goodboy/tractor
1
0
Fork 0

increased trio.sleep time for other actors to spawn

propagate_loglevel
Christian López Barrón 2019-03-09 18:43:17 +11:00
parent b992dc19e3
commit 2138d55a60
1 changed files with 3 additions and 1 deletions

View File

@ -45,13 +45,15 @@ async def hi():
async def say_hello(other_actor): async def say_hello(other_actor):
await trio.sleep(0.4) # wait for other actor to spawn await trio.sleep(1) # wait for other actor to spawn
async with tractor.find_actor(other_actor) as portal: async with tractor.find_actor(other_actor) as portal:
assert portal is not None
return await portal.run(__name__, 'hi') return await portal.run(__name__, 'hi')
async def say_hello_use_wait(other_actor): async def say_hello_use_wait(other_actor):
async with tractor.wait_for_actor(other_actor) as portal: async with tractor.wait_for_actor(other_actor) as portal:
assert portal is not None
result = await portal.run(__name__, 'hi') result = await portal.run(__name__, 'hi')
return result return result