This commit is contained in:
2026-03-08 04:02:51 +08:00
parent c9c4bc2bcd
commit 21bd3acf73
+15 -1
View File
@@ -123,7 +123,21 @@ class GeometryVerificationService:
cwd=str(stp_dir) # 在 STP 文件所在目录运行 cwd=str(stp_dir) # 在 STP 文件所在目录运行
) )
stdout, stderr = await process.communicate() # 增加超时时间到 300 秒(5分钟)
try:
stdout, stderr = await asyncio.wait_for(
process.communicate(),
timeout=300.0
)
except asyncio.TimeoutError:
logger.error("验证脚本执行超时(300秒)")
process.kill()
await process.wait()
return {
"status": "error",
"error": "验证脚本执行超时(300秒)",
"timestamp": datetime.now().isoformat()
}
stdout_text = stdout.decode('utf-8') if stdout else '' stdout_text = stdout.decode('utf-8') if stdout else ''
stderr_text = stderr.decode('utf-8') if stderr else '' stderr_text = stderr.decode('utf-8') if stderr else ''