Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ func recoverToError(do func(context.Context) error, onPanic func(any) error) fun

type Downloader struct {
Timeout Duration `yaml:"timeout" default:"5s"`
ReadTimeout Duration `yaml:"readTimeout" default:"20s"`
WriteTimeout Duration `yaml:"writeTimeout" default:"20s"`
Attempts uint `yaml:"attempts" default:"3"`
Cooldown Duration `yaml:"cooldown" default:"500ms"`
Expand Down
4 changes: 4 additions & 0 deletions docs/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ blocking:
# optional: timeout for list write to disk (each url). Use larger values for big lists or in constrained environments
# default: 20s
writeTimeout: 60s
# optional: timeout for reading the download (each url). Use large values for big lists or in constrained environments
# To disable this timeout, set to 0.
# default: 20s
readTimeout: 60s
# optional: Maximum download attempts
# default: 3
attempts: 5
Expand Down
1 change: 1 addition & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ Configures how HTTP(S) sources are downloaded:
| ------------ | -------- | --------- | ------------- | ---------------------------------------------- |
| timeout | duration | no | 5s | Download attempt timeout |
| writeTimeout | duration | no | 20s | File write attempt timeout |
| readTimeout | duration | no | 20s | Download request read timeout |
| attempts | int | no | 3 | How many download attempts should be performed |
| cooldown | duration | no | 500ms | Time between the download attempts |

Expand Down
4 changes: 2 additions & 2 deletions server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ type httpServer struct {
func newHTTPServer(name string, handler http.Handler, cfg *config.Config) *httpServer {
const (
readHeaderTimeout = 20 * time.Second
readTimeout = 20 * time.Second
)

var (
writeTimeout = cfg.Blocking.Loading.Downloads.WriteTimeout
readTimeout = cfg.Blocking.Loading.Downloads.ReadTimeout
)

return &httpServer{
inner: http.Server{
ReadTimeout: readTimeout,
ReadTimeout: time.Duration(readTimeout),
ReadHeaderTimeout: readHeaderTimeout,
WriteTimeout: time.Duration(writeTimeout),

Expand Down