Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03c833acbf | ||
|
|
0d369c7c79 |
@@ -2,6 +2,7 @@ package common
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/imroc/req/v3"
|
||||
"github.com/krau/SaveAny-Bot/config"
|
||||
@@ -10,7 +11,7 @@ import (
|
||||
var ReqClient *req.Client
|
||||
|
||||
func initClient() {
|
||||
ReqClient = req.NewClient().SetOutputDirectory(config.Cfg.Temp.BasePath)
|
||||
ReqClient = req.NewClient().SetOutputDirectory(config.Cfg.Temp.BasePath).SetTimeout(86400 * time.Second)
|
||||
}
|
||||
|
||||
func GetDownloadedFilePath(filename string) string {
|
||||
|
||||
@@ -29,7 +29,7 @@ func processPendingTask(task types.Task) error {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = common.ReqClient.R().SetContext(task.Ctx).SetOutputFile(task.FileName).SetDownloadCallbackWithInterval(func(info req.DownloadInfo) {
|
||||
_, err = common.ReqClient.R().SetOutputFile(task.FileName).SetDownloadCallbackWithInterval(func(info req.DownloadInfo) {
|
||||
if info.Response == nil || info.Response.Response == nil || info.Response.Response.StatusCode != 200 {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user