-
Notifications
You must be signed in to change notification settings - Fork 4
Django Session Cleanup (save 5 gb) #1121
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
Conversation
WalkthroughThis update removes all code, dependencies, templates, and settings related to social authentication using the Changes
Sequence Diagram(s)sequenceDiagram
participant Container
participant Django
Container->>Django: python manage.py invalidate_cachalot
Container->>Django: python manage.py clearsessions
Poem
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (3)
tcf_website/views/__init__.py (1)
7-7
: Consider declaring__all__
for explicit exports
As this module aggregates and re-exports view functions, adding an explicit__all__
list (e.g.,__all__ = ["ads", "login", "logout", ...]
) will make the public API clearer and suppress anyF401
lint warnings.🧰 Tools
🪛 Ruff (0.8.2)
7-7:
.auth.login
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
7-7:
.auth.logout
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
scripts/container-startup.sh (2)
14-15
: Improve logging around session cleanupRight now the
clearsessions
call runs silently. Adding simpleecho
statements before and after will make it easier to debug startup issues and verify that expired sessions were cleared successfully.Proposed diff:
- python manage.py clearsessions + echo 'Running Django clearsessions to remove expired sessions...' + python manage.py clearsessions + echo 'Django clearsessions completed'
14-15
: Consider restricting session cleanup to productionClearing sessions on every container start can be problematic in development or staging environments (it might remove in-use sessions). You could guard this command with an environment check:
- echo 'Running Django clearsessions to remove expired sessions...' - python manage.py clearsessions - echo 'Django clearsessions completed' + if [ "$DJANGO_ENV" = "production" ]; then + echo 'Running Django clearsessions to remove expired sessions...' + python manage.py clearsessions + echo 'Django clearsessions completed' + else + echo 'Skipping clearsessions (non-production environment)' + fi
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
requirements.txt
(0 hunks)scripts/container-startup.sh
(1 hunks)tcf_core/auth_pipeline.py
(0 hunks)tcf_core/settings/base.py
(0 hunks)tcf_core/urls.py
(0 hunks)tcf_website/templates/login/extra_info_form.html
(0 hunks)tcf_website/views/__init__.py
(1 hunks)tcf_website/views/auth.py
(0 hunks)
💤 Files with no reviewable changes (6)
- requirements.txt
- tcf_core/settings/base.py
- tcf_website/templates/login/extra_info_form.html
- tcf_website/views/auth.py
- tcf_core/urls.py
- tcf_core/auth_pipeline.py
🧰 Additional context used
🧬 Code Graph Analysis (1)
tcf_website/views/__init__.py (1)
tcf_website/views/auth.py (2)
login
(19-36)logout
(106-120)
🪛 Ruff (0.8.2)
tcf_website/views/__init__.py
7-7: .auth.login
imported but unused; consider removing, adding to __all__
, or using a redundant alias
(F401)
7-7: .auth.logout
imported but unused; consider removing, adding to __all__
, or using a redundant alias
(F401)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: django
- GitHub Check: pylint
🔇 Additional comments (1)
tcf_website/views/__init__.py (1)
7-7
:✅ Verification successful
Removed deprecated social-auth view imports
The import of onlylogin
andlogout
correctly reflects the removal ofcollect_extra_info
,login_error
, andpassword_error
, aligning with the broader cleanup of custom social authentication logic. Verify that no URL patterns or templates still reference the deleted views.Run the following to ensure no stray references remain:
🏁 Script executed:
#!/bin/bash # Verify removal of deprecated view imports rg -n 'collect_extra_info|login_error|password_error'Length of output: 55
Confirmed removal of deprecated social-auth view imports
Importing onlylogin
andlogout
intcf_website/views/__init__.py
correctly reflects the removal ofcollect_extra_info
,login_error
, andpassword_error
. A repository-wide search found no remaining references in URL patterns, templates, or other code.
- File affected: tcf_website/views/init.py (line 7)
- No occurrences of
collect_extra_info
,login_error
, orpassword_error
in the codebase🧰 Tools
🪛 Ruff (0.8.2)
7-7:
.auth.login
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
7-7:
.auth.logout
imported but unused; consider removing, adding to__all__
, or using a redundant alias(F401)
django clearsessions command
Summary by CodeRabbit