Evict expired items from SimpleCache

This commit is contained in:
Deluan
2024-06-24 17:30:13 -04:00
parent 3993c4d17f
commit 3bc9e75b28
3 changed files with 72 additions and 20 deletions
+1 -8
View File
@@ -107,14 +107,7 @@ func (p *playTracker) dispatchNowPlaying(ctx context.Context, userId string, t *
}
func (p *playTracker) GetNowPlaying(_ context.Context) ([]NowPlayingInfo, error) {
var res []NowPlayingInfo
for _, playerId := range p.playMap.Keys() {
info, err := p.playMap.Get(playerId)
if err != nil {
continue
}
res = append(res, info)
}
res := p.playMap.Values()
sort.Slice(res, func(i, j int) bool {
return res[i].Start.After(res[j].Start)
})