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 à :
Parent
cae0026a67
révision
a55cf2a803
1 fichiers modifiés avec 2 ajouts et 2 suppressions
|
@ -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(¶ms, "", fetcher.queueSize, 0)
|
||||
|
||||
if count == 0 {
|
||||
if len(dbTorrents) == 0 {
|
||||
log.Infof("No torrents for filesize update")
|
||||
return
|
||||
}
|
||||
|
|
Référencer dans un nouveau ticket