protect against cyclical configurations
parent
424a1c8858
commit
56d667dfe8
|
|
@ -62,7 +62,9 @@ class DistributedScript(scripts.Script):
|
|||
return scripts.AlwaysVisible
|
||||
|
||||
def ui(self, is_img2img):
|
||||
self.world.load_config()
|
||||
if not is_img2img: # prevents loading twice for no reason
|
||||
self.world.load_config()
|
||||
|
||||
extension_ui = UI(world=self.world)
|
||||
# root, api_exposed = extension_ui.create_ui()
|
||||
components = extension_ui.create_ui()
|
||||
|
|
|
|||
|
|
@ -145,6 +145,14 @@ class World:
|
|||
Worker: The worker object.
|
||||
"""
|
||||
|
||||
# protect against user trying to make cyclical setups and connections
|
||||
is_master = kwargs.get('master')
|
||||
if is_master is None or not is_master:
|
||||
m = self.master()
|
||||
if kwargs['address'] == m.address and kwargs['port'] == m.port:
|
||||
logger.error(f"refusing to add worker {kwargs['label']} as its socket definition({m.address}:{m.port}) matches master")
|
||||
return None
|
||||
|
||||
original = self[kwargs['label']] # if worker doesn't already exist then just make a new one
|
||||
if original is None:
|
||||
new = Worker(**kwargs)
|
||||
|
|
|
|||
Loading…
Reference in New Issue