-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handle periodic cleanup for sessions #3627
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
@debounce(60) | ||
def cleanup_orphaned_sessions(self) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perplexing bug; I would have thought that
marimo/marimo/_server/api/endpoints/ws.py
Lines 468 to 488 in 0d719dd
if self.manager.mode == SessionMode.RUN: | |
# When the websocket is closed, we wait session.ttl_seconds before | |
# closing the session. This is to prevent the session from being | |
# closed if the during an intermittent network issue. | |
def _close() -> None: | |
if self.status != ConnectionState.OPEN: | |
LOGGER.debug( | |
"Closing session %s (TTL EXPIRED)", | |
self.session_id, | |
) | |
# wait until TTL is expired before calling the cleanup | |
# function | |
cleanup_fn() | |
self.manager.close_session(self.session_id) | |
session = self.manager.get_session(self.session_id) | |
if session is not None: | |
cancellation_handle = asyncio.get_event_loop().call_later( | |
session.ttl_seconds, _close | |
) | |
self.cancel_close_handle = cancellation_handle |
handled this case. Unless somehow the websocket's on_disconnect is not called?
womp - all these tests work locally. none work in CI |
This may help #3623, but I have not tested yet.
I will test this manually in the meantime, and try to make a reliable test out of it.