File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -455,23 +455,22 @@ async def init(self):
455
455
async def _init_playwright_with_timeout (self ):
456
456
"""
457
457
Initialize playwright with a timeout to avoid hanging in strict event loop environments.
458
-
458
+
459
459
This method adds a timeout to the regular async_playwright().start() to prevent
460
460
hanging in environments that restrict blocking operations.
461
461
"""
462
462
self .logger .debug ("Starting playwright initialization with timeout..." )
463
-
463
+
464
464
try :
465
465
# Use asyncio.wait_for to add a timeout to prevent hanging
466
466
# If the environment doesn't allow blocking operations, this will fail fast
467
467
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
470
469
)
471
-
470
+
472
471
self .logger .debug ("Playwright initialized successfully" )
473
472
return playwright_instance
474
-
473
+
475
474
except asyncio .TimeoutError :
476
475
self .logger .error ("Playwright initialization timed out" )
477
476
raise RuntimeError (
You can’t perform that action at this time.
0 commit comments