Skip to content

Draft: http retry 5xx by default #493

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

bbtfr
Copy link
Member

@bbtfr bbtfr commented Jan 25, 2025

No description provided.

@bbtfr bbtfr changed the title http retry 5xx by default Draft: http retry 5xx by default Jan 25, 2025
Copy link

codecov bot commented Jan 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.98%. Comparing base (7be020a) to head (2c605e3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #493   +/-   ##
=======================================
  Coverage   99.98%   99.98%           
=======================================
  Files          44       44           
  Lines        6391     6391           
=======================================
  Hits         6390     6390           
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

stream=None,
verify=None,
cert=None,
json=None,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这堆参数感觉好像没必要,看起来是想支持位置参数,不过看到

  1. request.Session 里的调用 get / post / etc. 都是用 kwargs 传 data 之后的参数的
  2. 这里打 patch 的只是当前 session 对象,不会影响到其他 session 对象
    所以似乎只用关心 megfile 内部调用到的方法不会用位置参数就行,这个很好保证

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

files 以上主要是保持参数的顺序,以防真有用户按顺序传参,下面的属于顺手复制过去的

@@ -178,7 +166,7 @@ def open(
timeout = request_kwargs.pop("timeout", DEFAULT_TIMEOUT)
stream = request_kwargs.pop("stream", True)
try:
response = get_http_session(timeout=timeout, status_forcelist=()).get(
response = get_http_session(timeout=timeout).get(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

默认重试 500 感觉不太好,毕竟服务器错误一般来接重试是解决不了的,上面没改是为了保持接口的兼容,感觉可以大版本改成统一 500 不重试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants