diff --git a/service/scraper/scraper.go b/service/scraper/scraper.go index 76a308d9..70a9a039 100644 --- a/service/scraper/scraper.go +++ b/service/scraper/scraper.go @@ -191,7 +191,7 @@ func (sc *Scraper) Scrape(packets uint) { oldest := now.Add(0 - (time.Hour * 24 * 90)) query := fmt.Sprintf( - "SELECT * FROM ("+ + "SELECT * FROM ("+ // previously scraped torrents that will be scraped again: "SELECT %[1]s.torrent_id, torrent_hash FROM %[1]s, %[2]s WHERE "+ diff --git a/service/scraper/transaction.go b/service/scraper/transaction.go index 65e2c4cb..8fd71465 100644 --- a/service/scraper/transaction.go +++ b/service/scraper/transaction.go @@ -57,7 +57,7 @@ func (t *Transaction) handleScrapeReply(data []byte) { } -var pgQuery = "REPLACE INTO " + config.Conf.Models.ScrapeTableName + " (torrent_id, seeders, leechers, completed, last_scrape) VALUES ($1, $2, $3, $4, $5)" +var pgQuery = "INSERTE INTO " + config.Conf.Models.ScrapeTableName + " (torrent_id, seeders, leechers, completed, last_scrape) VALUES ($1, $2, $3, $4, $5) ON CONFLICT UPDATE" var sqliteQuery = "REPLACE INTO " + config.Conf.Models.ScrapeTableName + " (torrent_id, seeders, leechers, completed, last_scrape) VALUES (?, ?, ?, ?, ?)" // Sync syncs models with database