Small refactors

This commit is contained in:
Ben Adrian Sarmiento
2024-07-09 22:44:09 +02:00
parent b56ad95835
commit 6fc09e8486
3 changed files with 5 additions and 18 deletions

View File

@@ -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) {