Preallocate relatedTracks

This commit is contained in:
Youssef Habri 2020-02-11 00:33:28 +01:00
parent 2d44bc8515
commit 3be01b0c4a

View File

@ -19,7 +19,7 @@ func Get(ctx aero.Context) error {
return ctx.Error(http.StatusNotFound, "Track not found", err)
}
var relatedTracks []*arn.SoundTrack
relatedTracks := make([]*arn.SoundTrack, 0, 5)
for _, anime := range track.Anime() {
tracks := arn.FilterSoundTracks(func(t *arn.SoundTrack) bool {
return !t.IsDraft && len(t.Media) > 0 && t.ID != track.ID && arn.Contains(t.Tags, "anime:"+anime.ID)