egg [Feature Request] HttpClient should retry request when server closes connection

von4xj4u  于 6个月前  发布在  其他
关注(0)|答案(2)|浏览(51)

Background

When server closes connection at unfortunate time ( keep-alive race ), the http client will throw a ECONNRESET error.

Under this circumstance, agentkeepalive add req.reusedSocket to detect whether request is failed because reusing tcp connection.

Proposal

Add options retryWhenResuedSocketFail to HttpClient for whether retry request when get ECONNREST and req.reusedSocket is true . This options default value is true .

Seems Chrome do the same thing: https://codereview.chromium.org/303443011

lo8azlld

lo8azlld1#

I can do something for this proposal if necessary.

xqnpmsa8

xqnpmsa82#

urllib has 2 options: isRetry / retry , could we use it for this purpose

相关问题