chg: fix: do not cache empty results

This commit is contained in:
2025-07-30 14:16:06 +00:00
parent 4d6cfb8668
commit 3b9f49a9c0
6 changed files with 30 additions and 0 deletions

View File

@@ -79,6 +79,11 @@ func (i *Indexer) HandlerBluDVIndexer(w http.ResponseWriter, r *http.Request) {
links = append(links, link)
})
// if no links were indexed, expire the document in cache
if len(links) == 0 {
i.requester.ExpireDocument(ctx, url)
}
// extract each torrent link
indexedTorrents := utils.ParallelFlatMap(links, func(link string) ([]schema.IndexedTorrent, error) {
return getTorrentsBluDV(ctx, i, link)

View File

@@ -93,6 +93,11 @@ func (i *Indexer) HandlerComandoIndexer(w http.ResponseWriter, r *http.Request)
links = append(links, link)
})
// if no links were indexed, expire the document in cache
if len(links) == 0 {
i.requester.ExpireDocument(ctx, url)
}
// extract each torrent link
indexedTorrents := utils.ParallelFlatMap(links, func(link string) ([]schema.IndexedTorrent, error) {
return getTorrents(ctx, i, link)

View File

@@ -81,6 +81,11 @@ func (i *Indexer) HandlerComandoHDsIndexer(w http.ResponseWriter, r *http.Reques
links = append(links, link)
})
// if no links were indexed, expire the document in cache
if len(links) == 0 {
i.requester.ExpireDocument(ctx, url)
}
// extract each torrent link
indexedTorrents := utils.ParallelFlatMap(links, func(link string) ([]schema.IndexedTorrent, error) {
return getTorrentsComandoHDs(ctx, i, link)

View File

@@ -79,6 +79,11 @@ func (i *Indexer) HandlerRedeTorrentIndexer(w http.ResponseWriter, r *http.Reque
links = append(links, link)
})
// if no links were indexed, expire the document in cache
if len(links) == 0 {
i.requester.ExpireDocument(ctx, url)
}
// extract each torrent link
indexedTorrents := utils.ParallelFlatMap(links, func(link string) ([]schema.IndexedTorrent, error) {
return getTorrentsRedeTorrent(ctx, i, link)

View File

@@ -78,6 +78,11 @@ func (i *Indexer) HandlerStarckFilmesIndexer(w http.ResponseWriter, r *http.Requ
links = append(links, link)
})
// if no links were indexed, expire the document in cache
if len(links) == 0 {
i.requester.ExpireDocument(ctx, url)
}
// extract each torrent link
indexedTorrents := utils.ParallelFlatMap(links, func(link string) ([]schema.IndexedTorrent, error) {
return getTorrentStarckFilmes(ctx, i, link)

View File

@@ -78,6 +78,11 @@ func (i *Indexer) HandlerTorrentDosFilmesIndexer(w http.ResponseWriter, r *http.
links = append(links, link)
})
// if no links were indexed, expire the document in cache
if len(links) == 0 {
i.requester.ExpireDocument(ctx, url)
}
// extract each torrent link
indexedTorrents := utils.ParallelFlatMap(links, func(link string) ([]schema.IndexedTorrent, error) {
return getTorrentsTorrentDosFilmes(ctx, i, link)