forked from goodboy/tractor
				
			Add `open_root_actor(ensure_registry: bool)`
Allows forcing the opened actor to either obtain the passed registry addrs or raise a runtime error.remotes/1757153874605917753/main
							parent
							
								
									2d541fdd9b
								
							
						
					
					
						commit
						ebf9909cc4
					
				|  | @ -86,6 +86,10 @@ async def open_root_actor( | |||
|     enable_modules: list | None = None, | ||||
|     rpc_module_paths: list | None = None, | ||||
| 
 | ||||
|     # NOTE: allow caller to ensure that only one registry exists | ||||
|     # and that this call creates it. | ||||
|     ensure_registry: bool = False, | ||||
| 
 | ||||
| ) -> Actor: | ||||
|     ''' | ||||
|     Runtime init entry point for ``tractor``. | ||||
|  | @ -226,6 +230,12 @@ async def open_root_actor( | |||
|     # REGISTRAR | ||||
|     if ponged_addrs: | ||||
| 
 | ||||
|         if ensure_registry: | ||||
|             raise RuntimeError( | ||||
|                  f'Failed to open `{name}`@{ponged_addrs}: ' | ||||
|                 'registry socket(s) already bound' | ||||
|             ) | ||||
| 
 | ||||
|         # we were able to connect to an arbiter | ||||
|         logger.info( | ||||
|             f'Registry(s) seem(s) to exist @ {ponged_addrs}' | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue