Allow daemonizing top level actor; don't require main func
							parent
							
								
									db08dbad3b
								
							
						
					
					
						commit
						1da69b1396
					
				| 
						 | 
					@ -624,12 +624,15 @@ async def _start_actor(actor, main, host, port, arbiter_addr, nursery=None):
 | 
				
			||||||
                arbiter_addr=arbiter_addr,
 | 
					                arbiter_addr=arbiter_addr,
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					        if main is not None:
 | 
				
			||||||
            result = await main()
 | 
					            result = await main()
 | 
				
			||||||
        # XXX: If spawned locally, the actor is cancelled when this
 | 
					            # XXX: If spawned with a dedicated "main function",
 | 
				
			||||||
        # context is complete given that there are no more active
 | 
					            # the actor is cancelled when this context is complete
 | 
				
			||||||
        # peer channels connected to it.
 | 
					            # given that there are no more active peer channels connected to it.
 | 
				
			||||||
            actor.cancel_server()
 | 
					            actor.cancel_server()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # block on actor to complete
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # unset module state
 | 
					    # unset module state
 | 
				
			||||||
    _state._current_actor = None
 | 
					    _state._current_actor = None
 | 
				
			||||||
    log.info("Completed async main")
 | 
					    log.info("Completed async main")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue