-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: make sure config.httpclient.timeout >= 30000 #1165
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1165 +/- ##
==========================================
+ Coverage 99.7% 99.71% +0.01%
==========================================
Files 29 29
Lines 679 705 +26
==========================================
+ Hits 677 703 +26
Misses 2 2
Continue to review full report at Codecov.
|
|
为什么 3 秒? |
|
防止应用设置成小于 30s 的 |
|
这个是单次请求的超时时间还是? |
lib/core/httpclient.js
Outdated
| require('./dnscache_httpclient') : urllib.HttpClient; | ||
|
|
||
| const config = app.config.httpclient; | ||
| if (typeof config.timeout === 'number' && config.timeout < 30000) { |
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.
config.timeout 支持写成 3s 形式的么?
|
@popomore 我改一下,将 httpclient 的配置改成如下 httpclient: {
// urllib 的全局 options,优先级低于每次请求的 options
request: { timeout, ... }
// http agent options
httpAgent: { ... },
// https agent options
httpsAgent: { ... },
}为了保持兼容性,原来的配置写法统一支持,再下一个 major 版本再 depd。 |
lib/core/httpclient.js
Outdated
|
|
||
| const config = app.config.httpclient; | ||
| if (typeof config.timeout === 'number' && config.timeout < 30000) { | ||
| app.coreLogger.warn('[egg:httpclient] config.httpclient.timeout(%s) can\'t below 30000, auto reset to 30000', |
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.
逻辑没进来
|
可以合了吗? |
|
@gxcsoccer 还不行,我得改完 |
3ed3610 to
e0e0b9e
Compare
|
@gxcsoccer @popomore 可以 review 了,都兼容了,然后区分了。 |
distinguish options: request, httpAgent and httpsAgent on httpclient
277263c to
9227290
Compare
|
我提个 release |
Checklist
npm testpassesAffected core subsystem(s)
Description of change