fix: make SimulateEngine.stop() synchronous
The stop() method was async but called from a sync context, causing 'RuntimeError: no running event loop'. Changed to sync since it just sets flags.
This commit is contained in:
@@ -226,7 +226,7 @@ def stop_simulation(
|
|||||||
|
|
||||||
if run_id in running_simulations:
|
if run_id in running_simulations:
|
||||||
engine = running_simulations[run_id]
|
engine = running_simulations[run_id]
|
||||||
asyncio.create_task(engine.stop())
|
engine.stop()
|
||||||
simulation.status = "stopped"
|
simulation.status = "stopped"
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ class SimulateEngine:
|
|||||||
|
|
||||||
self.signals.append(signal)
|
self.signals.append(signal)
|
||||||
|
|
||||||
async def stop(self):
|
def stop(self):
|
||||||
self.running = False
|
self.running = False
|
||||||
self.status = "stopped"
|
self.status = "stopped"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user