Unrestrict uses download timeout
This commit is contained in:
@@ -44,11 +44,27 @@ func MainApp(configPath string) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
apiClient := http.NewHTTPClient(config.GetToken(), config.GetRetriesUntilFailed(), config.GetApiTimeoutSecs(), false, config, log.Named("httpclient"))
|
||||
apiClient := http.NewHTTPClient(
|
||||
config.GetToken(),
|
||||
config.GetRetriesUntilFailed(),
|
||||
config.GetApiTimeoutSecs(),
|
||||
false,
|
||||
config,
|
||||
log.Named("api_client"),
|
||||
)
|
||||
|
||||
rd := realdebrid.NewRealDebrid(apiClient, log.Named("realdebrid"))
|
||||
unrestrictClient := http.NewHTTPClient(
|
||||
config.GetToken(),
|
||||
config.GetRetriesUntilFailed(),
|
||||
config.GetDownloadTimeoutSecs(),
|
||||
false,
|
||||
config,
|
||||
log.Named("unrestrict_client"),
|
||||
)
|
||||
|
||||
premium.MonitorPremiumStatus(rd, zurglog)
|
||||
api := realdebrid.NewRealDebrid(apiClient, unrestrictClient, log.Named("realdebrid"))
|
||||
|
||||
premium.MonitorPremiumStatus(api, zurglog)
|
||||
|
||||
workerPool, err := ants.NewPool(config.GetNumOfWorkers())
|
||||
if err != nil {
|
||||
@@ -58,13 +74,13 @@ func MainApp(configPath string) {
|
||||
defer workerPool.Release()
|
||||
|
||||
utils.EnsureDirExists("data") // Ensure the data directory exists
|
||||
torrentMgr := torrent.NewTorrentManager(config, rd, workerPool, log.Named("manager"))
|
||||
torrentMgr := torrent.NewTorrentManager(config, api, workerPool, log.Named("manager"))
|
||||
|
||||
downloadClient := http.NewHTTPClient(config.GetToken(), config.GetRetriesUntilFailed(), config.GetDownloadTimeoutSecs(), true, config, log.Named("dlclient"))
|
||||
downloadClient := http.NewHTTPClient(config.GetToken(), config.GetRetriesUntilFailed(), config.GetDownloadTimeoutSecs(), true, config, log.Named("download_client"))
|
||||
downloader := universal.NewDownloader(downloadClient)
|
||||
|
||||
router := chi.NewRouter()
|
||||
handlers.AttachHandlers(router, downloader, torrentMgr, config, rd, workerPool, log.Named("router"))
|
||||
handlers.AttachHandlers(router, downloader, torrentMgr, config, api, workerPool, log.Named("router"))
|
||||
|
||||
// go func() {
|
||||
// if err := netHttp.ListenAndServe(":6060", nil); err != nil && err != netHttp.ErrServerClosed {
|
||||
|
||||
@@ -178,7 +178,7 @@ func (z *ZurgConfig) EnableDownloadMount() bool {
|
||||
|
||||
func (z *ZurgConfig) GetApiTimeoutSecs() int {
|
||||
if z.ApiTimeoutSecs == 0 {
|
||||
return 15
|
||||
return 60
|
||||
}
|
||||
return z.ApiTimeoutSecs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user