activities: fix slow load w/ lots of users

Added ID/Name indexing to mediabrowser, and cleaned it up a little bit.
Was taking ~2s with 5000 users and firing tons of requests at Jellyfin,
now take ~160ms from cold boot, ~1ms with cache.
This commit is contained in:
Harvey Tindall
2025-05-21 21:45:53 +01:00
parent 732ce1bc57
commit 1dfe13951f
3 changed files with 3 additions and 5 deletions
-2
View File
@@ -119,7 +119,6 @@ func (app *appContext) GetActivities(gc *gin.Context) {
var results []Activity
err := app.storage.db.Find(&results, query)
if err != nil {
app.err.Printf(lm.FailedDBReadActivities, err)
}
@@ -128,7 +127,6 @@ func (app *appContext) GetActivities(gc *gin.Context) {
Activities: make([]ActivityDTO, len(results)),
}
resp.LastPage = len(results) != req.Limit
for i, act := range results {
resp.Activities[i] = ActivityDTO{
ID: act.ID,