-
Notifications
You must be signed in to change notification settings - Fork 699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: custom timeout config #373
Conversation
config/config.go
Outdated
@@ -230,12 +233,19 @@ func (c *Config) ArchiveReadDays() int { | |||
return getIntValue("ARCHIVE_READ_DAYS", defaultArchiveReadDays) | |||
} | |||
|
|||
// RequestTimeout returns a Duration.time represent the request timeout | |||
func (c *Config) RequestTimeout() time.Duration { | |||
requestTimout := getIntValue("REQUEST_MAX_TIMEOUT", defaultRequestTimeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can name the variable HTTP_CLIENT_TIMEOUT
to be more explicit. In the future, the HTTP server timeout could be also configurable...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// 15MB max. | ||
maxBodySize = 1024 * 1024 * 15 | ||
) | ||
|
||
var cfg = config.NewConfig() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum.. I should refactor this config package. This is going to parse the config values twice during the process startup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about it when I wrote this.
It seem the config never change after the process startup. So it is OK to work though not so good. For now I cannot find out a way without parsing the config value again. Looking forward to your good news
Thank you for you pull-request but the In the master branch, you can now configure the HTTP client timeout with |
configurable timeout for bad network environment #302