core: cache S3 file storage clients#23168
Conversation
Agent-thread: https://sdko.org/internal/thr/ak/019ed837-6a7a-7492-bc76-93d55a130a27 A7k-product: product A7k-product-repo: 1 Co-authored-by: Agent <gptagent@svc.sdko.net>
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #23168 +/- ##
==========================================
+ Coverage 93.18% 93.23% +0.04%
==========================================
Files 1032 1035 +3
Lines 60196 60351 +155
Branches 400 400
==========================================
+ Hits 56094 56267 +173
+ Misses 4102 4084 -18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-5a27d156e798344879b78e838dd8a596348e5ab1
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-5a27d156e798344879b78e838dd8a596348e5ab1Afterwards, run the upgrade commands from the latest release notes. |
Summary
Why
The media file listing path can call into S3 URL generation repeatedly. Creating a fresh boto client for every access adds avoidable overhead, which is especially visible on slow S3-compatible backends.
Validation
uv run ruff check authentik/admin/files/backends/s3.py authentik/admin/files/backends/tests/test_s3_backend.pyuv run ruff format --check authentik/admin/files/backends/s3.py authentik/admin/files/backends/tests/test_s3_backend.pyuv run coverage run manage.py test --keepdb authentik/admin/files/backends/tests/test_s3_backend.py(2 passed, 25 skipped; live S3 tests skipped because the local S3 test service is not running)