fix: requests timeout (#4370)
This commit is contained in:
@@ -40,9 +40,9 @@ class HttpRequestNodeData(BaseNodeData):
|
||||
data: Union[None, str]
|
||||
|
||||
class Timeout(BaseModel):
|
||||
connect: int = MAX_CONNECT_TIMEOUT
|
||||
read: int = MAX_READ_TIMEOUT
|
||||
write: int = MAX_WRITE_TIMEOUT
|
||||
connect: Optional[int] = MAX_CONNECT_TIMEOUT
|
||||
read: Optional[int] = MAX_READ_TIMEOUT
|
||||
write: Optional[int] = MAX_WRITE_TIMEOUT
|
||||
|
||||
method: Literal['get', 'post', 'put', 'patch', 'delete', 'head']
|
||||
url: str
|
||||
|
@@ -95,8 +95,14 @@ class HttpRequestNode(BaseNode):
|
||||
if timeout is None:
|
||||
return HTTP_REQUEST_DEFAULT_TIMEOUT
|
||||
|
||||
if timeout.connect is None:
|
||||
timeout.connect = HTTP_REQUEST_DEFAULT_TIMEOUT.connect
|
||||
timeout.connect = min(timeout.connect, MAX_CONNECT_TIMEOUT)
|
||||
if timeout.read is None:
|
||||
timeout.read = HTTP_REQUEST_DEFAULT_TIMEOUT.read
|
||||
timeout.read = min(timeout.read, MAX_READ_TIMEOUT)
|
||||
if timeout.write is None:
|
||||
timeout.write = HTTP_REQUEST_DEFAULT_TIMEOUT.write
|
||||
timeout.write = min(timeout.write, MAX_WRITE_TIMEOUT)
|
||||
return timeout
|
||||
|
||||
|
Reference in New Issue
Block a user