From 8659a8a58bb46b5a7f23da7bd0fdd09c99864df3 Mon Sep 17 00:00:00 2001 From: Hugo Herter Date: Thu, 10 Feb 2022 16:53:40 +0100 Subject: [PATCH] Fix: forget_vm called twice when VM init times out Solution: Allow execution to be already missing. --- vm_supervisor/pool.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vm_supervisor/pool.py b/vm_supervisor/pool.py index 2a51a8143..00a09d348 100644 --- a/vm_supervisor/pool.py +++ b/vm_supervisor/pool.py @@ -47,7 +47,10 @@ async def get_running_vm(self, vm_hash: VmHash) -> Optional[VmExecution]: return None def forget_vm(self, vm_hash: VmHash) -> None: - self.executions.pop(vm_hash) + try: + del self.executions[vm_hash] + except KeyError: + pass async def stop(self): """Stop all VMs in the pool."""