Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Stop RSS from being so slow

Cette révision appartient à :
sfan5 2017-05-12 17:54:08 +02:00
Parent 38f23a3d7f
révision 5cb672b06a
2 fichiers modifiés avec 2 ajouts et 3 suppressions

Voir le fichier

@ -6,7 +6,6 @@ import (
"github.com/ewhal/nyaa/util/search"
"github.com/gorilla/feeds"
"net/http"
"strconv"
"time"
)
@ -31,7 +30,7 @@ func RSSHandler(w http.ResponseWriter, r *http.Request) {
for i, torrent := range torrents {
torrentJSON := torrent.ToJSON()
feed.Items[i] = &feeds.Item{
Id: "https://" + config.WebAddress + "/view/" + strconv.FormatUint(uint64(torrents[i].ID), 10),
Id: "https://" + config.WebAddress + "/view/" + torrentJSON.ID,
Title: torrent.Name,
Link: &feeds.Link{Href: string(torrentJSON.Magnet)},
Description: string(torrentJSON.Description),

Voir le fichier

@ -129,7 +129,7 @@ func getTorrentsOrderBy(parameters *serviceBase.WhereParams, orderBy string, lim
if conditions != "" {
dbQuery = dbQuery + " WHERE " + conditions
}
if strings.Contains(conditions, "torrent_name") {
if strings.Contains(conditions, "torrent_name") && offset > 0 {
dbQuery = "WITH t AS (SELECT * FROM torrents WHERE " + conditions + ") SELECT * FROM t"
}