Skip to content

Commit 3025458

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

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ 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+
return e.repo.UpdateAnalysisRecord(ctx, record)
166+
}
167+
161168
if status == entity.ReportStatus_Failed {
162169
record.Status = entity.InsightAnalysisStatus_Failed
163170
return e.repo.UpdateAnalysisRecord(ctx, record)

0 commit comments

Comments
 (0)