refactor: thread safe tasks

This commit is contained in:
Simon Ding
2025-04-08 14:01:32 +08:00
parent 9014f846be
commit 2bc71b0c66
5 changed files with 36 additions and 28 deletions

View File

@@ -199,7 +199,7 @@ func (c *Engine) downloadTorrent(m *ent.Media, r1 torznab.Result, seasonNum int,
}
torrent.Start()
c.tasks[history.ID] = &Task{Torrent: torrent}
c.tasks.Store(history.ID, &Task{Torrent: torrent})
c.sendMsg(fmt.Sprintf(message.BeginDownload, name))