Fixed concurrent access

This commit is contained in:
2017-11-24 15:14:29 +01:00
parent 49791a836e
commit 85a26a5c5b
3 changed files with 9 additions and 0 deletions

View File

@ -39,6 +39,9 @@ func Profile(ctx *aero.Context, viewUser *arn.User) string {
animeList = viewUser.AnimeList()
// Sort by rating
animeList.Lock()
defer animeList.Unlock()
sort.Slice(animeList.Items, func(i, j int) bool {
return animeList.Items[i].Rating.Overall > animeList.Items[j].Rating.Overall
})