Skip to content

Commit

Permalink
Immediately end sessions when all users are disconnected. (facebookre…
Browse files Browse the repository at this point in the history
  • Loading branch information
0mdc authored Aug 21, 2024
1 parent 01da078 commit 8f37d1d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/hitl/rearrange_v2/app_state_end_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def __init__(
self._status += f"\nError: {session.error}"

def get_next_state(self) -> Optional[AppStateBase]:
if self._elapsed_time > SESSION_END_DELAY:
connected_user_count = len(self._app_data.connected_users)
if self._elapsed_time > SESSION_END_DELAY or connected_user_count == 0:
self._end_session()
return create_app_state_reset(self._app_service, self._app_data)
return None
Expand Down

0 comments on commit 8f37d1d

Please sign in to comment.