Skip to content

Commit c317bb9

Browse files
committed
update timeout and handling of timeout errors
1 parent 32cc357 commit c317bb9

2 files changed

Lines changed: 2 additions & 23 deletions

File tree

src/aws_durable_execution_sdk_python_testing/cli.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ def invoke_command(self, args: argparse.Namespace) -> int:
360360
)
361361

362362
try:
363-
with urlopen(req, timeout=30) as response: # noqa: S310
363+
with urlopen(req, timeout=10) as response: # noqa: S310
364364
result = json.loads(response.read().decode("utf-8"))
365365
print(json.dumps(result, indent=2)) # noqa: T201
366366
return 0
@@ -381,9 +381,6 @@ def invoke_command(self, args: argparse.Namespace) -> int:
381381
"Error: Could not connect to the local runner server. Is it running?"
382382
)
383383
return 1
384-
except TimeoutError:
385-
logger.exception("Request timeout")
386-
return 1
387384
except Exception:
388385
logger.exception("Unexpected error in invoke command")
389386
return 1

tests/cli_test.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ def test_invoke_command_makes_http_request_to_start_execution_endpoint() -> None
638638
req = call_args[0][0]
639639
assert req.full_url.endswith("/start-durable-execution")
640640
assert req.get_header("Content-type") == "application/json"
641-
assert call_args[1]["timeout"] == 30
641+
assert call_args[1]["timeout"] == 10
642642

643643
# Verify payload structure
644644
payload = json.loads(req.data.decode("utf-8"))
@@ -697,24 +697,6 @@ def test_invoke_command_handles_connection_error() -> None:
697697
assert exit_code == 1
698698

699699

700-
def test_invoke_command_handles_timeout_error() -> None:
701-
"""Test that invoke command handles timeout errors gracefully."""
702-
app = CliApp()
703-
704-
with patch("aws_durable_execution_sdk_python_testing.cli.urlopen") as mock_urlopen:
705-
mock_urlopen.side_effect = TimeoutError("Request timed out")
706-
707-
exit_code = app.invoke_command(
708-
argparse.Namespace(
709-
function_name="test-function",
710-
input="{}",
711-
durable_execution_name=None,
712-
)
713-
)
714-
715-
assert exit_code == 1
716-
717-
718700
def test_invoke_command_handles_http_error_response() -> None:
719701
"""Test that invoke command handles HTTP error responses."""
720702
app = CliApp()

0 commit comments

Comments
 (0)