chg: fix: do not cache empty results
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user