-
-
Notifications
You must be signed in to change notification settings - Fork 213
Fix performance issues when loading api tokens #1812
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
|
The preview deployment failed. 🔴 Last updated at: 2025-06-18 18:12:36 CET |
Bundle ReportBundle size has no change ✅ |
WalkthroughThe code refactors the retrieval of API tokens and their usage history for a user. It replaces a single joined query with two separate queries—one for tokens and one for their usage history—then merges the results in PHP. Type annotations and imports are updated to reflect more generic types. Changes
Sequence Diagram(s)sequenceDiagram
participant Controller
participant ApiTokenRepository
participant DB
Controller->>ApiTokenRepository: getApiTokensForUser(user)
ApiTokenRepository->>DB: Query 1: Fetch tokens for user
DB-->>ApiTokenRepository: List of tokens
ApiTokenRepository->>DB: Query 2: Fetch last usage per token
DB-->>ApiTokenRepository: Map of token IDs to last usage info
ApiTokenRepository->>Controller: Combined token info with last usage
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 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: 1
🧹 Nitpick comments (1)
src/UserBundle/Twig/Components/ApiTokens.php (1)
38-40: Typed array downgraded tomixed– consider a small DTO insteadLoosening the return type sacrifices static analysis & autocomplete benefits across the template layer.
Wrapping the five fields in a readonly value-object (e.g.ApiTokenView) keeps type safety without re-introducing the heavy join you just removed.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/UserBundle/Repository/ApiTokenRepository.php(2 hunks)src/UserBundle/Twig/Components/ApiTokens.php(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (20)
- GitHub Check: DB (MariaDB pdo_mysql 11.0)
- GitHub Check: Lint
- GitHub Check: DB (PostgreSQL pdo_pgsql 16)
- GitHub Check: DB (MariaDB pdo_mysql 11.4)
- GitHub Check: DB (PostgreSQL pdo_pgsql 17)
- GitHub Check: DB (MariaDB pdo_mysql 11)
- GitHub Check: DB (MySQL pdo_mysql 9)
- GitHub Check: DB (MariaDB pdo_mysql 10.6)
- GitHub Check: DB (MySQL pdo_mysql 5.7)
- GitHub Check: DB (MariaDB pdo_mysql 10.11)
- GitHub Check: DB (MariaDB pdo_mysql 10.5)
- GitHub Check: DB (MySQL pdo_mysql 8.0)
- GitHub Check: DB (MySQL pdo_mysql 8.3)
- GitHub Check: DB (MySQL pdo_mysql 8.4)
- GitHub Check: DB (MariaDB pdo_mysql 10.4)
- GitHub Check: Analyze (javascript)
- GitHub Check: Unit ( PHP 8.3 )
- GitHub Check: Unit ( PHP 8.3 )
- GitHub Check: Unit ( PHP 8.4 )
- GitHub Check: PHPStan
🔇 Additional comments (1)
src/UserBundle/Repository/ApiTokenRepository.php (1)
77-85: [web_search]What database column type does Symfony\Bridge\Doctrine\Types\UlidType map to by default?
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 2.3.x #1812 +/- ##
============================================
+ Coverage 48.32% 48.85% +0.52%
- Complexity 2749 2800 +51
============================================
Files 501 510 +9
Lines 9936 10111 +175
============================================
+ Hits 4802 4940 +138
- Misses 5134 5171 +37
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes #1811