Refactoring

This commit is contained in:
Loic Guegan 2022-06-28 11:51:21 +02:00
parent 6b697fa14f
commit be6d819080

View file

@ -353,10 +353,10 @@ class Simulator:
f.write("Breakpoints every "+str(breakpoints_every)+"s\n") f.write("Breakpoints every "+str(breakpoints_every)+"s\n")
##### Simulation loop ##### Simulation loop
while True: while True:
# Synchronize every nodes # Synchronize non-blocking api calls
for node in self.nodes: for node in self.nodes:
self.sync_node_non_blocking(node) self.sync_node_non_blocking(node)
# Manage events # Synchronize blocking api calls
for node in self.nodes: for node in self.nodes:
self.sync_node_blocking(node) self.sync_node_blocking(node)
# Generate debug logs # Generate debug logs
@ -369,7 +369,7 @@ class Simulator:
for node_id in self.wait_end_nodes: for node_id in self.wait_end_nodes:
self.nodes[node_id]["state"]="running" self.nodes[node_id]["state"]="running"
self.nodes[node_id].rqueue.put(("sim_end",0)) self.nodes[node_id].rqueue.put(("sim_end",0))
self.sync_node_non_blocking(self.nodes[node_id]) # Allow them for make call requests (printing logs for example) self.sync_node_non_blocking(self.nodes[node_id]) # Allow them for make non-blocking call requests (printing logs for example)
break # End the event processing loop break # End the event processing loop
# Update simulation time # Update simulation time