mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2026-04-28 03:30:10 +00:00
⚡️ Speed up method AsyncOperationPool._get_operation by 10% (#1914)
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
This commit is contained in:
parent
f9832b1657
commit
bc9afaeb3c
1 changed files with 5 additions and 1 deletions
|
|
@ -83,7 +83,11 @@ class AsyncOperationPool:
|
|||
self._add_operation(task_id, operation)
|
||||
|
||||
def _get_operation(self, task_id: str, agent_phase: AgentPhase) -> AsyncOperation | None:
|
||||
return self._operations.get(task_id, {}).get(agent_phase, None)
|
||||
# Direct dictionary access and exception handling to minimize overhead
|
||||
try:
|
||||
return self._operations[task_id][agent_phase]
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
def _remove_operations(self, task_id: str) -> None:
|
||||
if task_id in self._operations:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue