daemon: moved node instantiation into lock to guarantee id uniqueness, removed node count from environment as it also attmpts to use lock and wouldnt be accurate either
This commit is contained in:
parent
d94bae6b42
commit
8587da0621
1 changed files with 1 additions and 2 deletions
|
@ -998,7 +998,6 @@ class Session:
|
|||
env["SESSION_NAME"] = str(self.name)
|
||||
env["SESSION_FILENAME"] = str(self.file_name)
|
||||
env["SESSION_USER"] = str(self.user)
|
||||
env["SESSION_NODE_COUNT"] = str(self.get_node_count())
|
||||
if state:
|
||||
env["SESSION_STATE"] = str(self.state)
|
||||
# attempt to read and add environment config file
|
||||
|
@ -1067,8 +1066,8 @@ class Session:
|
|||
:return: the created node instance
|
||||
:raises core.CoreError: when id of the node to create already exists
|
||||
"""
|
||||
node = _class(self, *args, **kwargs)
|
||||
with self.nodes_lock:
|
||||
node = _class(self, *args, **kwargs)
|
||||
if node.id in self.nodes:
|
||||
node.shutdown()
|
||||
raise CoreError(f"duplicate node id {node.id} for {node.name}")
|
||||
|
|
Loading…
Reference in a new issue