Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Use NoCount version of GetTorrents

The normal GetTorrents version always called COUNT(*) on the query,
which consistently took around 300 ms. With the NoCount, the SELECT
queries take 5-50 ms.
Cette révision appartient à :
ElegantMonkey 2017-05-14 18:24:41 -03:00
Parent cae0026a67
révision a55cf2a803

Voir le fichier

@ -196,9 +196,9 @@ func (fetcher *MetainfoFetcher) fillQueue() {
} else {
params = serviceBase.CreateWhereParams("((filesize IS NULL OR filesize = 0) OR (torrents.torrent_id NOT IN (SELECT files.torrent_id FROM files WHERE files.torrent_id = torrents.torrent_id))) AND date > ?", oldest)
}
dbTorrents, count, err := torrentService.GetTorrents(params, fetcher.queueSize, 0)
dbTorrents, err := torrentService.GetTorrentsOrderByNoCount(&params, "", fetcher.queueSize, 0)
if count == 0 {
if len(dbTorrents) == 0 {
log.Infof("No torrents for filesize update")
return
}