Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/narada-pyodide/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[project]
name = "narada-pyodide"
version = "0.0.53"
version = "0.0.54"
description = "Pyodide-compatible Python client SDK for Narada"
license = "Apache-2.0"
readme = "README.md"
Expand Down
8 changes: 6 additions & 2 deletions packages/narada-pyodide/src/narada/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import asyncio
import json
import logging
import os
Expand Down Expand Up @@ -90,7 +91,9 @@ async def open_and_initialize_cloud_browser_window(
}

response = None
for _ in range(3):
max_attempts = 3
retry_backoff_seconds = (2.0, 4.0, 0.0) # no wait after last attempt
for attempt in range(max_attempts):
# Due to unknown network issues, sometimes create-and-initialize-cloud-browser-session API call fails.
try:
response = await pyfetch(
Expand All @@ -102,6 +105,7 @@ async def open_and_initialize_cloud_browser_window(
if response.ok:
break
except Exception:
await asyncio.sleep(retry_backoff_seconds[attempt])
continue

if response is None or not response.ok:
Expand All @@ -110,7 +114,7 @@ async def open_and_initialize_cloud_browser_window(
await response.text() if response is not None else "unknown error"
)
raise RuntimeError(
"Failed to create and initialize cloud browser session after 3 attempts: "
"Failed to create and initialize cloud browser session after 3 attempts with backoff: "
f"{resp_status}: {resp_text}\n"
f"Endpoint URL: {endpoint_url}"
)
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading