fix: stop polling when simulation fails

Previously, the frontend only checked for 'completed' and 'stopped'
status to stop polling. When the simulation process exited with an
error (runner_status === 'failed'), polling continued indefinitely.

This commit adds handling for the 'failed' status:
- Stop polling when runner_status is 'failed'
- Display error message in the log
- Update UI status to 'error'
- Add i18n translations for simFailed key
This commit is contained in:
cuixiao 2026-04-11 19:35:02 +08:00
parent fa0f6519b1
commit e606b2c229
3 changed files with 8 additions and 0 deletions

View File

@ -513,6 +513,7 @@ const fetchRunStatus = async () => {
// runner_status
const isCompleted = data.runner_status === 'completed' || data.runner_status === 'stopped'
const isFailed = data.runner_status === 'failed'
// runner_status
// twitter_completed reddit_completed
@ -526,6 +527,11 @@ const fetchRunStatus = async () => {
phase.value = 2
stopPolling()
emit('update-status', 'completed')
} else if (isFailed) {
addLog(t('log.simFailed') + (data.error ? `: ${data.error}` : ''))
phase.value = 2
stopPolling()
emit('update-status', 'error')
}
}
} catch (err) {

View File

@ -537,6 +537,7 @@
"stopException": "Stop error: {error}",
"allPlatformsCompleted": "✓ All platform simulations have ended",
"simCompleted": "✓ Simulation completed",
"simFailed": "✗ Simulation failed",
"reportRequestSent": "Report generation request sent, please wait...",
"startingReportGen": "Starting report generation...",
"reportGenTaskStarted": "✓ Report generation task started: {reportId}",

View File

@ -537,6 +537,7 @@
"stopException": "停止异常: {error}",
"allPlatformsCompleted": "✓ 检测到所有平台模拟已结束",
"simCompleted": "✓ 模拟已完成",
"simFailed": "✗ 模拟失败",
"reportRequestSent": "报告生成请求已发送,请稍候...",
"startingReportGen": "正在启动报告生成...",
"reportGenTaskStarted": "✓ 报告生成任务已启动: {reportId}",