Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Merge pull request #362 from majestrate/scraper

only scrape torrents uploaded within 90 days
Cette révision appartient à :
PantsuDev 2017-05-11 23:43:59 +10:00 révisé par GitHub
révision b2c1ac13b4

Voir le fichier

@ -179,8 +179,9 @@ func (sc *Scraper) removeStale() {
func (sc *Scraper) Scrape(packets uint) {
now := time.Now().Add(0 - sc.interval)
rows, err := db.ORM.Raw("SELECT torrent_id, torrent_hash FROM torrents WHERE last_scrape IS NULL OR last_scrape < ? ORDER BY torrent_id DESC LIMIT ?", now, packets*ScrapesPerPacket).Rows()
// only scrape torretns uploaded within 90 days
oldest := now.Add(0 - (time.Hour * 24 * 90))
rows, err := db.ORM.Raw("SELECT torrent_id, torrent_hash FROM torrents WHERE last_scrape IS NULL OR last_scrape < ? AND date > ? ORDER BY torrent_id DESC LIMIT ?", now, oldest, packets*ScrapesPerPacket).Rows()
if err == nil {
counter := 0
var scrape [ScrapesPerPacket]model.Torrent