add get page video timeout (#1710)

This commit is contained in:
Shuchang Zheng
2025-02-04 14:56:37 +08:00
committed by GitHub
parent 59756cb1d2
commit f0b274d31d

View File

@@ -480,14 +480,22 @@ class BrowserState:
return return
if len(self.browser_artifacts.video_artifacts) > index: if len(self.browser_artifacts.video_artifacts) > index:
if self.browser_artifacts.video_artifacts[index].video_path is None: if self.browser_artifacts.video_artifacts[index].video_path is None:
self.browser_artifacts.video_artifacts[index].video_path = await page.video.path() try:
async with asyncio.timeout(settings.BROWSER_ACTION_TIMEOUT_MS / 1000):
self.browser_artifacts.video_artifacts[index].video_path = await page.video.path()
except asyncio.TimeoutError:
LOG.info("Timeout to get the page video, skip the exception")
return return
target_lenght = index + 1 target_lenght = index + 1
self.browser_artifacts.video_artifacts.extend( self.browser_artifacts.video_artifacts.extend(
[VideoArtifact()] * (target_lenght - len(self.browser_artifacts.video_artifacts)) [VideoArtifact()] * (target_lenght - len(self.browser_artifacts.video_artifacts))
) )
self.browser_artifacts.video_artifacts[index].video_path = await page.video.path() try:
async with asyncio.timeout(settings.BROWSER_ACTION_TIMEOUT_MS / 1000):
self.browser_artifacts.video_artifacts[index].video_path = await page.video.path()
except asyncio.TimeoutError:
LOG.info("Timeout to get the page video, skip the exception")
return return
async def get_or_create_page( async def get_or_create_page(