cli/vms: serialize uuid already in the api

This commit is contained in:
Jörg Thalheim
2023-09-27 11:11:30 +02:00
committed by Mic92
parent 08eab785c6
commit dea49073cb
2 changed files with 6 additions and 16 deletions

View File

@@ -82,13 +82,9 @@ class TaskPool:
self.lock: threading.RLock = threading.RLock()
self.pool: dict[UUID, BaseTask] = {}
def __getitem__(self, uuid: str | UUID) -> BaseTask:
def __getitem__(self, uuid: UUID) -> BaseTask:
with self.lock:
if type(uuid) is UUID:
return self.pool[uuid]
else:
uuid = UUID(uuid)
return self.pool[uuid]
return self.pool[uuid]
def __setitem__(self, uuid: UUID, task: BaseTask) -> None:
with self.lock: