Skip to content

Honor zero CachedResponse timeouts without falling back - #683

Open
jackwalkerlabs wants to merge 1 commit into
pallets-eco:stablefrom
jackwalkerlabs:fix/cached-response-zero-timeout
Open

jackwalkerlabs wants to merge 1 commit into
pallets-eco:stablefrom
jackwalkerlabs:fix/cached-response-zero-timeout

Conversation

@jackwalkerlabs

Copy link
Copy Markdown

A CachedResponse(timeout=0) currently falls back to the decorator’s timeout because the override uses a truthiness check. Preserve zero as the cache backend’s “never expire” value, including timedelta(0). None still falls back to the decorator timeout.

Found during source inspection. Both zero-timeout regressions fail before this change. Validation on Python 3.12/macOS: 171 passed, 8 skipped, 1 deselected, excluding backend integration files and the unavailable Memcached case. Tests advance the existing fake clock to verify expiration behavior. Mypy passes; Pyright reports 0 errors (one unavailable uwsgi-runtime warning); all pre-commit hooks pass.

Test command: pytest tests --ignore=tests/test_backend_cache.py --ignore=tests/test_cachelib.py -k 'not Memcached' -q.

Implemented and tested using Codex under the submitting account's authorization.

Implemented and validated with Codex.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant