From 109472a88e5f486e3cf7e9ea96ca31d4979c9771 Mon Sep 17 00:00:00 2001 From: YouROK <8YouROK8@mail.ru> Date: Thu, 16 Feb 2023 20:31:59 +0300 Subject: [PATCH] fix rutor --- server/rutor/rutor.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/server/rutor/rutor.go b/server/rutor/rutor.go index c984996..fb6eaed 100644 --- a/server/rutor/rutor.go +++ b/server/rutor/rutor.go @@ -116,25 +116,16 @@ func loadDB() { return } - var channel = make(chan *models.TorrentDetails, 0) - go func() { - for torr := range channel { - ftorrs = append(ftorrs, torr) - } - torrs = ftorrs - }() - for dec.More() { var torr *models.TorrentDetails err = dec.Decode(&torr) if err == nil { - channel <- torr + ftorrs = append(ftorrs, torr) } else { log.TLogln("Error read rutor db:", err) } } - close(channel) - + torrs = ftorrs log.TLogln("Index rutor db") torrsearch.NewIndex(torrs) log.TLogln("Torrents count:", len(torrs))