Allow daemonizing top level actor; don't require main func

drop_main_kwarg
Tyler Goodlet 2018-08-03 09:41:18 -04:00
parent db08dbad3b
commit 1da69b1396
1 changed files with 8 additions and 5 deletions

View File

@ -624,11 +624,14 @@ async def _start_actor(actor, main, host, port, arbiter_addr, nursery=None):
arbiter_addr=arbiter_addr, arbiter_addr=arbiter_addr,
) )
) )
result = await main() if main is not None:
# XXX: If spawned locally, the actor is cancelled when this result = await main()
# context is complete given that there are no more active # XXX: If spawned with a dedicated "main function",
# peer channels connected to it. # the actor is cancelled when this context is complete
actor.cancel_server() # given that there are no more active peer channels connected to it.
actor.cancel_server()
# block on actor to complete
# unset module state # unset module state
_state._current_actor = None _state._current_actor = None