Example #1
0
func WriteDbTorrent(db core.Database, c chan *core.Torrent, totalRows int64) {
	start := time.Now()
	count := int64(0)
	for t := range c {
		count++
		db.Add(t)
		if count%10000 == 0 {
			eta := time.Now().Sub(start) / time.Duration(count) * time.Duration(totalRows-count)
			log.Println("Loaded: ", count, "of", totalRows, "(ETA:", eta.String()+")")
		}
	}
}