refactor: dedupe jikan refresh

This commit is contained in:
2026-06-01 22:21:19 +02:00
committed by Milas Holsting
parent 085fe3e83d
commit be27625a3c
2 changed files with 9 additions and 14 deletions

View File

@@ -94,18 +94,7 @@ func (c *Client) refreshAnimeByID(ctx context.Context, id int) (Anime, error) {
}
func (c *Client) refreshAnimeByIDAsync(id int) {
select {
case c.refreshSem <- struct{}{}:
default:
return
}
go func() {
defer func() { <-c.refreshSem }()
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
defer cancel()
c.runAsyncRefresh(func(ctx context.Context) {
_, _ = c.refreshAnimeByID(ctx, id)
}()
})
}