Stop RSS from being so slow
Cette révision appartient à :
Parent
38f23a3d7f
révision
5cb672b06a
2 fichiers modifiés avec 2 ajouts et 3 suppressions
|
@ -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),
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
||||
|
|
Référencer dans un nouveau ticket