Skip to content

refactor(session): reuse _stash_session_manager in SessionMiddleware.dispatch - #219

Merged
allen0099 merged 1 commit into
masterfrom
refactor/session-stash-helper
Sep 26, 2026
Merged

allen0099 merged 1 commit into
masterfrom
refactor/session-stash-helper

Conversation

@allen0099

Copy link
Copy Markdown
Owner

Closes #169 (part of #117)

SessionMiddleware.dispatch repeated the body of _stash_session_manager inline, while FastAPICacheXSessionMiddleware already called the helper. Both copies registered the manager on app.state on the first request only. dispatch now calls the helper, so the two middlewares cannot drift apart.

No behaviour change, so there is no CHANGELOG entry.

Tests

No new tests. The existing ones already cover this path: replacing the call with pass fails four tests in tests/session/test_get_session_manager.py.

Ruff, mypy --strict and the full suite against live Redis and Memcached (897 passed).

…dispatch

SessionMiddleware.dispatch repeated the helper's body inline, so the two
copies could drift apart. No behaviour change.

Closes #169
@allen0099 allen0099 added this to the 0.3.8 milestone Sep 26, 2026
@allen0099 allen0099 added enhancement New feature or request session Session management subsystem labels Sep 26, 2026
@allen0099
allen0099 merged commit dab9cd1 into master Sep 26, 2026
11 checks passed
@allen0099
allen0099 deleted the refactor/session-stash-helper branch September 26, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request session Session management subsystem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reuse _stash_session_manager in SessionMiddleware.dispatch

1 participant