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

@ -33,6 +33,9 @@ func GetStatsByUser(ctx *aero.Context) string {
return ctx.Error(http.StatusInternalServerError, "Anime list not found", err)
}
animeList.Lock()
defer animeList.Unlock()
for _, item := range animeList.Items {
currentWatch := item.Episodes * item.Anime().EpisodeLength
reWatch := item.RewatchCount * item.Anime().EpisodeCount * item.Anime().EpisodeLength