From 27675c89f2d639d7a21174ae6cdccc36c2ff5774 Mon Sep 17 00:00:00 2001 From: YouROK <8yourok8@mail.ru> Date: Fri, 11 Dec 2020 15:48:02 +0300 Subject: [PATCH] fix whel delete from db and getting torrent --- src/server/torr/apihelper.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/server/torr/apihelper.go b/src/server/torr/apihelper.go index 2f5e2de..363fcfe 100644 --- a/src/server/torr/apihelper.go +++ b/src/server/torr/apihelper.go @@ -59,18 +59,20 @@ func GetTorrent(hashHex string) *Torrent { return tor } - tor = GetTorrentDB(hash) - - go func() { - tr, _ := NewTorrent(tor.TorrentSpec, bts) - if tr != nil { - tr.Title = tor.Title - tr.Poster = tor.Poster - tr.Size = tor.Size - tr.Timestamp = tor.Timestamp - tr.GotInfo() - } - }() + tr := GetTorrentDB(hash) + if tr != nil { + tor = tr + go func() { + tr, _ := NewTorrent(tor.TorrentSpec, bts) + if tr != nil { + tr.Title = tor.Title + tr.Poster = tor.Poster + tr.Size = tor.Size + tr.Timestamp = tor.Timestamp + tr.GotInfo() + } + }() + } return tor }