feat(labrinth): basic offset pagination for moderation reports and projects #4063
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
These changes add basic pagination capabilities to the Labrinth routes for fetching moderation reports and projects pending review, using standard
LIMITandOFFSETSQL clauses.Although these clauses can become inefficient when doing deep pagination (and at the moment the reports fetching route takes ~400 ms to complete), the current primary bottleneck when rendering the related moderation pages is the need to fetch a large amount of project data for each report, very significantly contributing to the several seconds it can take for the page to load. In this context, even a somewhat slow paginated route is an improvement, as it helps the frontend distribute the load of high-volume data queries around.
Additionally, I added an index to the reports table to enable more efficient filtering by report status, which should help reduce the cost of sequential database scans.