Skip to content

perf(images): reduce internal Docker I/O and add proxy and browser im… - #445

Closed
Shillerxorg wants to merge 1 commit into
Git-Romer:mainfrom
Shillerxorg:perf/image-caching-network-io
Closed

Shillerxorg wants to merge 1 commit into
Git-Romer:mainfrom
Shillerxorg:perf/image-caching-network-io

Conversation

@Shillerxorg

Copy link
Copy Markdown
Contributor

…age caching

  • Nginx proxy cache: add a dedicated 1GB disk cache zone in frontend nginx for /api/images/ with proxy_cache_lock to prevent redundant multi-hop transfers between frontend, backend, and PostgreSQL.
  • Backend HTTP cache headers: send Cache-Control with immutable 30-day max-age and ETag for official card and set images, and 1-hour must-revalidate for custom cards. Return 304 Not Modified on matching If-None-Match.
  • Frontend image loading: preserve native lazy loading in CardImage without forcing eager loading when entering the viewport margin.
  • Database: avoid passing pool arguments to create_engine when running tests against SQLite.
  • Tests: add comprehensive unit tests in test_image_cache_headers.py covering 200 headers, 304 responses, weak ETags, and custom card caching.

What and why

Validation

  • Relevant automated checks pass
  • Documentation was updated when behavior changed

Card UI (when applicable)

  • I checked docs/CARD_SYSTEM.md and followed the established card visual language where it fits
  • I included desktop/mobile screenshots or explained why they are not relevant
  • If this introduces a genuinely new visual idea, I explained why the existing patterns do not fit

…age caching

- Nginx proxy cache: add a dedicated 1GB disk cache zone in frontend nginx for /api/images/ with proxy_cache_lock to prevent redundant multi-hop transfers between frontend, backend, and PostgreSQL.
- Backend HTTP cache headers: send Cache-Control with immutable 30-day max-age and ETag for official card and set images, and 1-hour must-revalidate for custom cards. Return 304 Not Modified on matching If-None-Match.
- Frontend image loading: preserve native lazy loading in CardImage without forcing eager loading when entering the viewport margin.
- Database: avoid passing pool arguments to create_engine when running tests against SQLite.
- Tests: add comprehensive unit tests in test_image_cache_headers.py covering 200 headers, 304 responses, weak ETags, and custom card caching.
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.

1 participant