Refactor credential lock handling in execute_node

Improved readability by formatting multi-line calls to creds_manager.acquire and the credential lock release condition. No functional changes were made.
This commit is contained in:
Nicholas Tindle
2025-12-04 00:14:14 -06:00
parent 0cd3088b57
commit 7d25534def

View File

@@ -243,7 +243,9 @@ async def execute_node(
)
file_name = field_data.get("name", "selected file")
try:
credentials, lock = await creds_manager.acquire(user_id, cred_id)
credentials, lock = await creds_manager.acquire(
user_id, cred_id
)
creds_locks.append(lock)
extra_exec_kwargs[kwarg_name] = credentials
except ValueError:
@@ -298,7 +300,11 @@ async def execute_node(
finally:
# Ensure all credentials are released even if execution fails
for creds_lock in creds_locks:
if creds_lock and (await creds_lock.locked()) and (await creds_lock.owned()):
if (
creds_lock
and (await creds_lock.locked())
and (await creds_lock.owned())
):
try:
await creds_lock.release()
except Exception as e: