-
Notifications
You must be signed in to change notification settings - Fork 258
fix: make session clearing resilient #1010
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
Draft
nerdoza
wants to merge
9
commits into
h3js:main
Choose a base branch
from
nerdoza:fix/zombie-sessions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
81d8fbe
fix: make session clear resilient
nerdoza 8dcb0f3
refactor: consolidate TTL logic
nerdoza 1abf637
docs: add notes about session rotation
nerdoza 382ffe4
style: resolve lint issues
nerdoza 9b53343
fix: use initialize for session sealing
nerdoza 7361537
revert: restore getSession calls in utility functions
nerdoza 16bb190
docs: correct typo in session docs
nerdoza 370ce91
refactor: change to clobber session object
nerdoza f5644e7
docs: remove notes about session rotation
nerdoza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This should be reverted to allow this PR move forward as a refactor step.
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.
I'm a bit confused @pi0. This line is the main point of this PR. If you want to isolate changes I'd be more apt to revert the refactor changes on this PR and apply them on a separate PR intended for refactor changes. Thoughts?
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.
We can do this as part of #1022 for session rotate. clear purpose is to destroy session fully not to create a new one.
Alternatively we can set a
_destroyed
flag to previous object to indicate it is invalid.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.
@pi0, I'm in complete agreement on that point, but the implementation at the code level is not 1:1 with the user experience. When the user calls
clear()
they want the session cleared, and then if they callupdate()
they would expect that this creates a new session (or at least that's what I would assume). Because theupdate()
call is eagerly restoring the session from therequest
, callingupdate()
returns a mutation of the same session that was previously cleared.TLDR; If a new session is not set on the
context.sessions[sessionName]
whenclear()
is called, then the session isn't actually cleared, it's just temporarily reset (and will be restored on next access call).