Skip to content

Commit 871a25e

Browse files
committed
running for 3h+ is thought failed
1 parent b02c189 commit 871a25e

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

backend/modules/evaluation/domain/entity/expt_insight_analysis_record.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ const (
1414
InsightAnalysisStatus_Failed InsightAnalysisStatus = 3
1515
)
1616

17+
const (
18+
ThreeHour = 3 * time.Hour
19+
)
20+
1721
type ExptInsightAnalysisRecord struct {
1822
ID int64
1923
SpaceID int64

backend/modules/evaluation/domain/service/insight_analysis_impl.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,14 @@ func (e ExptInsightAnalysisServiceImpl) checkAnalysisReportGenStatus(ctx context
158158
if err != nil {
159159
return err
160160
}
161+
162+
// 超过3小时,未生成分析报告,认为是失败
163+
if status == entity.ReportStatus_Running && record.CreatedAt.Add(entity.ThreeHour).Unix() >= CreateAt {
164+
record.Status = entity.InsightAnalysisStatus_Failed
165+
logs.CtxWarn(ctx, "checkAnalysisReportGenStatus found timeout event, expt_id: %v, record_id: %v", record.ExptID, record.ID)
166+
return e.repo.UpdateAnalysisRecord(ctx, record)
167+
}
168+
161169
if status == entity.ReportStatus_Failed {
162170
record.Status = entity.InsightAnalysisStatus_Failed
163171
return e.repo.UpdateAnalysisRecord(ctx, record)

0 commit comments

Comments
 (0)