fix duplicate torrents (again)

This commit is contained in:
2026-02-03 18:47:10 +03:00
parent 82b0c567fe
commit 13b132f5f0
2 changed files with 5 additions and 11 deletions

12
main.go
View File

@@ -112,16 +112,10 @@ func main() {
}
}
guidTorrent, _ := m.GetTorrentByGuid(torrent.Guid)
guidTorrent, _ := m.GetTorrentByGuidAndItemId(torrent.Guid, item.ID)
if guidTorrent != nil {
_, err = db.NamedExec("UPDATE torrents SET seeders = :seeders, peers = :peers WHERE guid = :guid", map[string]any{
"seeders": seeders,
"peers": peers,
"guid": torrent.Guid,
})
if err != nil {
log.Printf("couldn't update seers & peers for torrent guid=%s: %v\n", torrent.Guid, err)
}
// already have this exact one, for this item. ABORT!
continue
}
// this shit will duplicate. idk if it's ok or not, but fuck it. we ball