Skip to content
Merged
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
11 changes: 9 additions & 2 deletions packages/narada/src/narada/client.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes it does not detect the browser window id even thought it is visible on the cloud session replay. In such cases reloading the page helps.

The default timeout is 30s, I put 8s in a loop of max 5 retries which would give us 45s max (8*5 + 5 sleep second). On practice, it takes 1-2 iterations (8-16 seconds), so this is better to reload each 8 seconds instead of reloading after default 30s.

Original file line number Diff line number Diff line change
Expand Up @@ -283,18 +283,25 @@ async def _initialize_cloud_browser_window(

# Wait for browser window ID. The extension can take a bit to be installed, so we retry a
# few times.
max_attempts = 5
max_attempts = 10
for attempt in range(max_attempts):
try:
browser_window_id = await self._wait_for_browser_window_id(
initialization_page, config
initialization_page,
config,
timeout=4_000,
)
break
except NaradaExtensionMissingError:
if attempt == max_attempts - 1:
raise
logging.info("Waiting for Narada extension to be installed...")
await asyncio.sleep(1)
except NaradaTimeoutError:
if attempt == max_attempts - 1:
raise
# If browser window ID is not found, reload the page and try again
await initialization_page.reload()

cloud_window = CloudBrowserWindow(
browser_window_id=browser_window_id,
Expand Down
Loading