Skip to content

Commit 7950230

Browse files
pmbrullclaude
andcommitted
refactor(ometa): drop noisy comment, expose timeout in SSE stream()
- Remove the fix-rationale comment from the request_kwargs block; that context lives in the PR description and would rot in-tree. - Add an optional timeout parameter to SSEClient.stream(), forwarded to requests. Defaults to None (no timeout, prior behavior). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 3f0f6f9 commit 7950230

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

ingestion/src/metadata/ingestion/ometa/sse_client.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ def __init__(self, config: ClientConfig, max_retries=5, retry_delay=2):
3636
self.stream_completed: bool = False
3737
self.logger: Logger = ometa_logger()
3838

39-
def stream(self, method: str, path: str, data: None | dict[str, Any] = None) -> Generator[Any, Any, None]:
39+
def stream(
40+
self,
41+
method: str,
42+
path: str,
43+
data: None | dict[str, Any] = None,
44+
timeout: None | float | tuple[float, float] = None,
45+
) -> Generator[Any, Any, None]:
4046
"""Connect to the SSE stream and yield events.
4147
4248
Args:
@@ -87,18 +93,14 @@ def stream(self, method: str, path: str, data: None | dict[str, Any] = None) ->
8793
if self.last_event_id:
8894
headers["Last-Event-ID"] = self.last_event_id
8995

90-
# SSE transport uses `requests` rather than `httpx`: the SDK's REST client
91-
# already uses requests, and some enterprise security middleboxes reject
92-
# httpx's HTTP/1.1 wire pattern (lowercase header names, header/body in
93-
# separate TCP segments) while passing requests/wget through unchanged.
9496
request_kwargs = {
9597
"method": method,
9698
"url": str(url),
9799
"headers": headers,
98100
"json": opts.get("json"),
99101
"params": opts.get("params"),
100102
"stream": True,
101-
"timeout": None,
103+
"timeout": timeout,
102104
"verify": (
103105
self.config.verify if self.config.verify is not None else True
104106
),

0 commit comments

Comments
 (0)