mirror of
https://git.sr.ht/~joren/streamrip-go
synced 2026-06-17 15:05:39 +02:00
performance: tune shared HTTP transport for concurrent CDN downloads
This commit is contained in:
@@ -114,13 +114,20 @@ func New(cfg *config.Config) (*Main, error) {
|
||||
Config: cfg,
|
||||
Providers: providers,
|
||||
Store: db,
|
||||
DL: download.NewWithOptions(cfg.Session.Downloads.VerifySSL, cfg.Session.CLI.ProgressBars),
|
||||
DL: download.NewWithOptions(cfg.Session.Downloads.VerifySSL, cfg.Session.CLI.ProgressBars, downloaderMaxConnsPerHost(cfg.Session.Downloads.MaxConnections)),
|
||||
Tagger: tag.New(),
|
||||
Pending: []media.Pending{},
|
||||
Media: []media.Media{},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func downloaderMaxConnsPerHost(maxConnections int) int {
|
||||
if maxConnections > 16 {
|
||||
return maxConnections
|
||||
}
|
||||
return 16
|
||||
}
|
||||
|
||||
func (m *Main) Close() error {
|
||||
m.DL.Close()
|
||||
artwork.CleanupTempDirs()
|
||||
|
||||
@@ -309,7 +309,7 @@ func TestTrackRipFailsWhenTaggerReportsMissingFFmpeg(t *testing.T) {
|
||||
"qobuz": &fakeProvider{url: ts.URL},
|
||||
},
|
||||
Store: sqlite,
|
||||
DL: download.NewWithOptions(true, false),
|
||||
DL: download.NewWithOptions(true, false, 0),
|
||||
Tagger: failingTagger{err: fmt.Errorf("ffmpeg not found: %w", exec.ErrNotFound)},
|
||||
}
|
||||
|
||||
@@ -537,7 +537,7 @@ func TestPlaylistRipPipeline(t *testing.T) {
|
||||
"qobuz": &fakePlaylistProvider{url: ts.URL},
|
||||
},
|
||||
Store: sqlite,
|
||||
DL: download.NewWithOptions(true, false),
|
||||
DL: download.NewWithOptions(true, false, 0),
|
||||
Tagger: noopTagger{},
|
||||
}
|
||||
|
||||
@@ -588,7 +588,7 @@ func TestPlaylistRipUsesSourceSubdirectory(t *testing.T) {
|
||||
"qobuz": &fakePlaylistProvider{url: ts.URL},
|
||||
},
|
||||
Store: sqlite,
|
||||
DL: download.NewWithOptions(true, false),
|
||||
DL: download.NewWithOptions(true, false, 0),
|
||||
Tagger: noopTagger{},
|
||||
}
|
||||
|
||||
@@ -773,7 +773,7 @@ func TestRipAlbumUsesResolvedAudioProfileForFolderName(t *testing.T) {
|
||||
"qobuz": fake,
|
||||
},
|
||||
Store: sqlite,
|
||||
DL: download.NewWithOptions(true, false),
|
||||
DL: download.NewWithOptions(true, false, 0),
|
||||
Tagger: noopTagger{},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user