mirror of
https://github.com/langgenius/dify.git
synced 2026-06-22 19:21:13 +08:00
fix(watercrawl): bound client request timeouts (#37515)
This commit is contained in:
parent
dcff1870d5
commit
adfd820220
@ -12,6 +12,8 @@ from core.rag.extractor.watercrawl.exceptions import (
|
||||
WaterCrawlPermissionError,
|
||||
)
|
||||
|
||||
WATERCRAWL_REQUEST_TIMEOUT: httpx.Timeout = httpx.Timeout(30.0, connect=5.0)
|
||||
|
||||
|
||||
class SpiderOptions(TypedDict):
|
||||
max_depth: int
|
||||
@ -48,7 +50,7 @@ class BaseAPIClient:
|
||||
"User-Agent": "WaterCrawl-Plugin",
|
||||
"Accept-Language": "en-US",
|
||||
}
|
||||
return httpx.Client(headers=headers, timeout=None)
|
||||
return httpx.Client(headers=headers, timeout=WATERCRAWL_REQUEST_TIMEOUT)
|
||||
|
||||
def _request(
|
||||
self,
|
||||
|
||||
@ -73,6 +73,9 @@ class TestBaseAPIClient:
|
||||
assert client.session == "session"
|
||||
assert captured["headers"]["X-API-Key"] == "k"
|
||||
assert captured["headers"]["User-Agent"] == "WaterCrawl-Plugin"
|
||||
assert captured["timeout"] is not None
|
||||
assert captured["timeout"].connect is not None
|
||||
assert captured["timeout"].read is not None
|
||||
|
||||
def test_request_stream_and_non_stream_paths(self, monkeypatch: pytest.MonkeyPatch):
|
||||
class FakeSession:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user