Skip to content
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

sessions/mysql: Del expired sessions on startup. #1669

Merged
merged 2 commits into from Aug 5, 2022

Conversation

lukebp
Copy link
Member

@lukebp lukebp commented Aug 4, 2022

This commit adds code to the sessions database that deletes all expired
sessions from the database on startup.

The session store does not delete expired sessions from the database
automatically. The gorilla/sessions API does not allow the session ID to
be retrieved from a session cookie once the session has expired, so
there is no way for the session store to know what IDs needs to be
deleted from the database. The database layer must track when the
session was created and manually delete expired sessions.

This commit also removes the session database tests. They were poorly
written and, in some cases, weren't actually testing what they thought
they were. I have a seperate commit that rewrites the tests from
scratch. I split the commits up because the diff easier to read.

This commit adds code to the sessions database that deletes all expired
sessions from the database on startup.

The session store does not delete expired sessions from the database
automatically. The gorilla/sessions API does not allow the session ID to
be retrieved from a session cookie once the session has expired, so
there is no way for the session store to know what IDs needs to be
deleted from the database. The database layer must track when the
session was created and manually delete expired sessions.

This commit also removes the session database tests. They were poorly
written and, in some cases, weren't actually testing what they thought
they were. I have a seperate commit that rewrites the tests from
scratch. I split the commits up because the diff easier to read.
@lukebp lukebp changed the title sessions: Cleanup expired sessions on startup. sessions/mysql: Del expired sessions on startup. Aug 4, 2022
Copy link
Member

@alexlyp alexlyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK

@lukebp lukebp merged commit cf41fe8 into decred:master Aug 5, 2022
@lukebp lukebp deleted the sessionsdb branch August 12, 2022 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants