Merge pull request #362 from majestrate/scraper
only scrape torrents uploaded within 90 days
Cette révision appartient à :
révision
b2c1ac13b4
1 fichiers modifiés avec 3 ajouts et 2 suppressions
|
@ -179,8 +179,9 @@ func (sc *Scraper) removeStale() {
|
||||||
|
|
||||||
func (sc *Scraper) Scrape(packets uint) {
|
func (sc *Scraper) Scrape(packets uint) {
|
||||||
now := time.Now().Add(0 - sc.interval)
|
now := time.Now().Add(0 - sc.interval)
|
||||||
|
// only scrape torretns uploaded within 90 days
|
||||||
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()
|
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 {
|
if err == nil {
|
||||||
counter := 0
|
counter := 0
|
||||||
var scrape [ScrapesPerPacket]model.Torrent
|
var scrape [ScrapesPerPacket]model.Torrent
|
||||||
|
|
Référencer dans un nouveau ticket