Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

remove uneeded retry helper

Nick Sweetingc080e86ec215
diff --git a/browser_use/controller/service.py b/browser_use/controller/service.py
index bd4dfcfc9..ebc0f3c1a 100644
--- a/browser_use/controller/service.py
+++ b/browser_use/controller/service.py
@@ -4,8 +4,7 @@ import json
import logging
import os
import re
-from collections.abc import Awaitable, Callable
-from typing import Any, Generic, TypeVar, cast
+from typing import Generic, TypeVar, cast
try:
from lmnr import Laminar # type: ignore
@@ -42,38 +41,6 @@ from browser_use.utils import time_execution_sync
logger = logging.getLogger(__name__)
-async def retry_async_function(
- func: Callable[[], Awaitable[Any]], error_message: str, n_retries: int = 3, sleep_seconds: float = 1
-) -> Any:
- """
- Retry an async function n times before giving up and raising an exception.
-
- Args:
- func: Async function to retry
- error_message: Error message to use in exception if all retries fail
- n_retries: Number of retries (default 3)
- sleep_seconds: Seconds to sleep between retries (default 1)
-
- Returns:
- The result of the function on success
-
- Raises:
- RuntimeError: If all retries fail
- """
- for attempt in range(n_retries):
- try:
- result = await func()
- return result
- except Exception as e:
- await asyncio.sleep(sleep_seconds)
- logger.debug(f'Error (attempt {attempt + 1}/{n_retries}): {e}')
- if attempt == n_retries - 1: # Last attempt failed
- raise RuntimeError(error_message + str(e))
-
- # Should never reach here but make type checker happy
- raise RuntimeError(error_message)
-
-
Context = TypeVar('Context')
T = TypeVar('T', bound=BaseModel)
diff --git a/browser_use/sync/auth.py b/browser_use/sync/auth.py
index cf98d4c26..7721b6bba 100644
--- a/browser_use/sync/auth.py
+++ b/browser_use/sync/auth.py
@@ -317,7 +317,7 @@ class DeviceAuthClient:
self.auth_config.save_to_file()
if show_instructions:
- logger.info('✅ Authentication successful! Cloud sync is now enabled.')
+ logger.debug('✅ Authentication successful! Cloud sync is now enabled with your browser-use account.')
return True
@@ -335,10 +335,10 @@ class DeviceAuthClient:
pass
except Exception as e:
# Other unexpected errors
- logger.warning(f'Unexpected error during cloud authentication: {type(e).__name__}: {e}')
+ logger.warning(f'❌ Unexpected error during cloud sync authentication: {type(e).__name__}: {e}')
if show_instructions:
- logger.info('❌ Authentication failed or timed out')
+ logger.debug(f'❌ Sync authentication failed or timed out with {CONFIG.BROWSER_USE_CLOUD_API_URL}')
return False