Skip to content

Commit 4596922

Browse files
linter
1 parent 08af605 commit 4596922

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

stagehand/main.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -455,23 +455,22 @@ async def init(self):
455455
async def _init_playwright_with_timeout(self):
456456
"""
457457
Initialize playwright with a timeout to avoid hanging in strict event loop environments.
458-
458+
459459
This method adds a timeout to the regular async_playwright().start() to prevent
460460
hanging in environments that restrict blocking operations.
461461
"""
462462
self.logger.debug("Starting playwright initialization with timeout...")
463-
463+
464464
try:
465465
# Use asyncio.wait_for to add a timeout to prevent hanging
466466
# If the environment doesn't allow blocking operations, this will fail fast
467467
playwright_instance = await asyncio.wait_for(
468-
async_playwright().start(),
469-
timeout=30.0 # 30 second timeout
468+
async_playwright().start(), timeout=30.0 # 30 second timeout
470469
)
471-
470+
472471
self.logger.debug("Playwright initialized successfully")
473472
return playwright_instance
474-
473+
475474
except asyncio.TimeoutError:
476475
self.logger.error("Playwright initialization timed out")
477476
raise RuntimeError(

0 commit comments

Comments
 (0)