diff --git a/internal/torrent/refresh.go b/internal/torrent/refresh.go index 292523d..b055299 100644 --- a/internal/torrent/refresh.go +++ b/internal/torrent/refresh.go @@ -375,7 +375,7 @@ func (t *TorrentManager) assignDirectory(tor *Torrent, triggerHook bool, outputL if outputLogs { t.log.Warnf("No playable files for %s, moving to unplayable directory", accessKey) } - t.markAsUnplayable(tor, "no playable files") + t.markAsUnplayable(tor) return } diff --git a/internal/torrent/repair.go b/internal/torrent/repair.go index 7937f48..1358ebc 100644 --- a/internal/torrent/repair.go +++ b/internal/torrent/repair.go @@ -46,19 +46,6 @@ func (t *TorrentManager) StartRepairJob() { } } }) - - // repair worker - t.workerPool.Submit(func() { - for { - select { - case torrent := <-t.repairChan: - t.invokeRepair(torrent) - case <-t.RepairWorkerKillSwitch: - t.repairLog.Info("Stopping periodic repair job") - return - } - } - }) } // EnqueueForRepair allows an on-demand repair to be initiated. @@ -447,7 +434,7 @@ func (t *TorrentManager) assignLinks(torrent *Torrent) bool { } else { t.repairLog.Warnf("Torrent %s is rar'ed and we cannot repair it, moving to unplayable directory", t.GetKey(torrent)) t.markAsUnfixable(torrent, "rar'ed by RD") - t.markAsUnplayable(torrent, "rar'ed by RD") + t.markAsUnplayable(torrent) torrent.State.Event(context.Background(), "mark_as_repaired") } @@ -603,7 +590,7 @@ func (t *TorrentManager) canCapacityHandle() bool { } } -func (t *TorrentManager) markAsUnplayable(torrent *Torrent, reason string) { +func (t *TorrentManager) markAsUnplayable(torrent *Torrent) { // reassign to unplayable torrents directory t.DirectoryMap.IterCb(func(directory string, torrents cmap.ConcurrentMap[string, *Torrent]) { if strings.HasPrefix(directory, "int__") { diff --git a/internal/universal/downloader.go b/internal/universal/downloader.go index 9cddf9e..c490910 100644 --- a/internal/universal/downloader.go +++ b/internal/universal/downloader.go @@ -258,13 +258,13 @@ func (dl *Downloader) streamFileToResponse( return } - dl.workerPool.Submit(func() { + go func() { dl.TrafficServed.Add(uint64(n)) if cfg.ShouldLogRequests() && bToMb(uint64(n)) > 0 { log.Debugf("Served %d MB of file %s (range=%s)", bToMb(uint64(n)), unrestrict.Filename, req.Header.Get("Range")) } - }) + }() } func redirect(resp http.ResponseWriter, req *http.Request, url string) {