Users page is now cached

This commit is contained in:
2017-06-14 17:16:03 +02:00
parent 07702a598f
commit d42f161fdd
6 changed files with 53 additions and 12 deletions

View File

@ -2,7 +2,6 @@ package users
import (
"net/http"
"sort"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
@ -11,13 +10,7 @@ import (
// Get ...
func Get(ctx *aero.Context) string {
users, err := arn.FilterUsers(func(user *arn.User) bool {
return user.IsActive() && user.Avatar != ""
})
sort.Slice(users, func(i, j int) bool {
return users[i].Registered < users[j].Registered
})
users, err := arn.GetActiveUsersCached()
if err != nil {
return ctx.Error(http.StatusInternalServerError, "Could not fetch user data", err)