Skip to content

Conversation

@crKtv
Copy link
Contributor

@crKtv crKtv commented Dec 31, 2025

Since this was ordered by torrent_id, if a torrent was uploaded and pending moderation and other trusted torrents were uploaded after it, those would bury the pending moderation torrent once it was approved. Ordering by created_at fixes this.

Since this was ordering by torrent_id, if a torrent was uploaded and pending mod queue and other trusted torrents were uploaded after, these would bury the pending mod queue torrent after it gets approved. Ordering by created_at fixes it.
(Fix) Update TopTorrents newest tab
Revert "(Fix) Update TopTorrents newest tab"
Since this was ordering by torrent_id, if a torrent was uploaded and pending mod queue and other trusted torrents were uploaded after, these would bury the pending mod queue torrent after it gets approved. Ordering by created_at fixes it.
Copy link
Collaborator

@Roardom Roardom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the created_at index apply to this new query? What are the query times for the previous query and for this new query for a database with a few hundred thousand torrents? Given that this query is loaded on the home page, we try to make it as efficient as possible.

@crKtv
Copy link
Contributor Author

crKtv commented Jan 1, 2026

From my rough testing and lack of knowledge on how to check it properly, I didn't see any performance hit on a 100k torrent set. If you want to look further into it, I can close this and open an issue instead.

@Roardom
Copy link
Collaborator

Roardom commented Jan 2, 2026

By default, when you have APP_DEBUG set to true in your .env, a debug bar will appear on the bottom of every page allowing you to see the db queries and the length of time it took to complete the query. You might also need to add DEBUGBAR_OPEN_STORAGE=true to your .env to see past http requests since the chatbox will send additional http requests after the initial page load. You can use the folder button in the top right of the debugbar to view previous http requests to find the one that loaded the TopTorrents.

@Roardom
Copy link
Collaborator

Roardom commented Jan 2, 2026

On my local setup, previously, it took 3.24ms. Now it's takes 394ms. That's a very big performance drop, especially for the frequently loaded home page. Can you try and get it below 10ms? For perspective, the other 50 home page queries finish in 93ms combined.

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.

2 participants