From c1c438cd18d9b87680feaaab379d4f8753999a08 Mon Sep 17 00:00:00 2001 From: Hugo Herter Date: Tue, 5 Mar 2024 18:28:18 +0100 Subject: [PATCH] Fix: Stopping executions could be returned Solution: Reuse `pool.get_running_vm` that checks if the execution is being stopped. --- src/aleph/vm/pool.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/aleph/vm/pool.py b/src/aleph/vm/pool.py index 031a33c2b..25a5f0c48 100644 --- a/src/aleph/vm/pool.py +++ b/src/aleph/vm/pool.py @@ -89,9 +89,10 @@ async def create_a_vm( # Check if an execution is already present for this VM, then return it. # Do not `await` in this section. - try: - return self.executions[vm_hash] - except KeyError: + current_execution = self.get_running_vm(vm_hash) + if current_execution: + return current_execution + else: execution = VmExecution( vm_hash=vm_hash, message=message,