dify
dify copied to clipboard
feat: add support for request timeout settings in the HTTP request node.
Description
Backend
- Add Timeout type and timeout field to HttpRequestNodeData
- Modify the HTTP_REQUEST_DEFAULT_TIMEOUT setting to have a connection timeout of 10 seconds, read timeout of 60 seconds, and write timeout of 20 seconds
- Apply the timeout configuration on httpx
Frontend
- Add readOnly, min, max attributes to the Input component
- Add Timeout settings to the HTTP Request Node
- Add i18n information
Fixes #3806 #3808
Type of Change
Please delete options that are not relevant.
- [x] New feature (non-breaking change which adds functionality)
How Has This Been Tested?
I am debugging locally to ensure that the timeout parameter is passed into httpx and that the request is successful.
Suggested Checklist:
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [x] My changes generate no new warnings
- [x] I ran
dev/reformat
(backend) andcd web && npx lint-staged
(frontend) to appease the lint gods - [ ]
optional
I have made corresponding changes to the documentation - [ ]
optional
I have added tests that prove my fix is effective or that my feature works - [ ]
optional
New and existing unit tests pass locally with my changes
Hello thanks for your contribution, please add my wechat: crazyphage. I will invite you to our developer group chat.
I suggest a max timeout to avoid network blocking issues, otherwise it brings a memory leak problem.
I suggest a max timeout to avoid network blocking issues, otherwise it brings a memory leak problem.
The timeout period can vary depending on different business scenario requirements. Should we impose this limit on the frontend or the backend? How does 10 minutes sound?
I suggest a max timeout to avoid network blocking issues, otherwise it brings a memory leak problem.
The timeout period can vary depending on different business scenario requirements. Should we impose this limit on the frontend or the backend? How does 10 minutes sound?
I prefer using environment variables to specify default max timeout of it, how do you think of this? we can use 10 minutes by default.
I suggest a max timeout to avoid network blocking issues, otherwise it brings a memory leak problem.
The timeout period can vary depending on different business scenario requirements. Should we impose this limit on the frontend or the backend? How does 10 minutes sound?
I prefer using environment variables to specify default max timeout of it, how do you think of this? we can use 10 minutes by default.
If we use environment variables to set the timeout, we need to consider the maximum value allowed by the frontend components. Do we need to provide an environment variable at both the API layer and the frontend layer?
@Yeuoly Add environment variables HTTP_REQUEST_MAX_CONNECT_TIMEOUT, HTTP_REQUEST_MAX_READ_TIMEOUT, HTTP_REQUEST_MAX_WRITE_TIMEOUT to limit the maximum timeout duration of HTTP requests. The default values are respectively 5 minutes, 10 minutes, and 10 minutes.