Skip to content

Commit adb51fb

Browse files
style: move has_app/user_delta checks inside if block for readability
1 parent 9ec1187 commit adb51fb

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎src/google/adk/sessions/database_session_service.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,12 +536,13 @@ async def append_event(self, session: Session, event: Event) -> Event:
536536
# FOR UPDATE locks on rows that will actually be written.
537537
# The result is reused later to avoid calling extract_state_delta twice.
538538
state_deltas = None
539+
has_app_delta, has_user_delta = False, False
539540
if event.actions and event.actions.state_delta:
540541
state_deltas = _session_util.extract_state_delta(
541542
event.actions.state_delta
542543
)
543-
has_app_delta = bool(state_deltas and state_deltas.get("app"))
544-
has_user_delta = bool(state_deltas and state_deltas.get("user"))
544+
has_app_delta = bool(state_deltas.get("app"))
545+
has_user_delta = bool(state_deltas.get("user"))
545546

546547
async with self._with_session_lock(
547548
app_name=session.app_name,

0 commit comments

Comments
 (0)