-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
"Authorized applications" in settings takes 18.6 seconds to load #20477
Comments
I can't reproduce it, but how many registered apps do you have? |
There's at least one N+1 when doing |
Somewhere in the neighborhood of about ~130 or so? It's a lot. |
Update: this page load now results in a complete failure. I have no idea how many authorized applications I have, and I am actually completely unable to revoke any of them or do any sort of management on them. Which seems... problematic, to say the least... |
I just checked, 114 applications at the moment on this specific account
|
I have a test account on mastodon.social that easily has a thousand logins and https://mastodon.social/oauth/authorized_applications returns 503. |
There is indeed a N+1 in the view, The most recently used token's last usage date can be fetched for all apps at once, using a query like: last_used_at_by_app = Doorkeeper::AccessToken
.select('DISTINCT ON (application_id) application_id, last_used_at')
.where(resource_owner_id: current_user.id)
.where.not(last_used_at: nil)
.order(application_id: :desc, last_used_at: :desc)
.pluck(:application_id, :last_used_at)
.to_h This query takes < 1ms for OP's account on mastodon.social. |
Steps to reproduce the problem
Go to Settings > Account > Authorized applications
Expected behaviour
it loads quickly
Actual behaviour
it loads very slowly (18.6s)
Detailed description
No response
Specifications
mastodon.social
The text was updated successfully, but these errors were encountered: