Skip to content

Commit f71b7ba

Browse files
committed
fix: decrease log frequency
1 parent 3aa0511 commit f71b7ba

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

internal/job/event_processor_job.go

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ func (j *EventProcessorJob) embeddingProcessWorkspaces(ctx context.Context) {
132132
}
133133
if codebaseEnv.Switch == dto.SwitchOff {
134134
j.logger.Info("codebase is disabled, skipping embedding process")
135+
time.Sleep(time.Second * 10)
135136
return
136137
}
137138

@@ -147,9 +148,9 @@ func (j *EventProcessorJob) embeddingProcessWorkspaces(ctx context.Context) {
147148
return
148149
}
149150

150-
workspackePaths := make([]string, len(workspaces))
151+
workspacePaths := make([]string, len(workspaces))
151152
for i, workspace := range workspaces {
152-
workspackePaths[i] = workspace.WorkspacePath
153+
workspacePaths[i] = workspace.WorkspacePath
153154
}
154155

155156
// 在处理事件前再次检查上下文是否已取消
@@ -161,7 +162,7 @@ func (j *EventProcessorJob) embeddingProcessWorkspaces(ctx context.Context) {
161162
// 继续执行
162163
}
163164

164-
err = j.embedding.ProcessEmbeddingEvents(j.ctx, workspackePaths)
165+
err = j.embedding.ProcessEmbeddingEvents(j.ctx, workspacePaths)
165166
if err != nil {
166167
j.logger.Error("failed to process embedding events: %v", err)
167168
}
@@ -176,6 +177,20 @@ func (j *EventProcessorJob) codegraphProcessWorkSpaces(ctx context.Context) erro
176177
default:
177178
// 继续执行
178179
}
180+
181+
// 检查是否关闭codebase
182+
codebaseEnv := j.storage.GetCodebaseEnv()
183+
if codebaseEnv == nil {
184+
codebaseEnv = &config.CodebaseEnv{
185+
Switch: dto.SwitchOn,
186+
}
187+
}
188+
if codebaseEnv.Switch == dto.SwitchOff {
189+
j.logger.Info("codebase is disabled, skipping codegraph process")
190+
time.Sleep(time.Second * 10)
191+
return nil
192+
}
193+
179194
// 获取活跃工作区
180195
workspaces, err := j.codegraph.ProcessActiveWorkspaces(j.ctx)
181196
if err != nil {

internal/service/codebase.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,13 @@ func (l *codebaseService) Summarize(ctx context.Context, req *dto.GetIndexSummar
554554
if err != nil {
555555
return nil, err
556556
}
557+
status := model.CodegraphStatusInit
558+
if summary.TotalFiles > 0 {
559+
status = model.CodegraphStatusSuccess
560+
}
557561
resp := &dto.IndexSummary{
558562
Codegraph: dto.CodegraphInfo{
559-
Status: convertStatus(model.CodegraphStatusBuilding),
563+
Status: convertStatus(status),
560564
TotalFiles: summary.TotalFiles,
561565
},
562566
}
@@ -595,9 +599,9 @@ func convertStatus(status int) string {
595599
var indexStatus string
596600
switch status {
597601
case model.CodegraphStatusBuilding:
598-
indexStatus = "success"
599-
case model.CodegraphStatusSuccess:
600602
indexStatus = "running"
603+
case model.CodegraphStatusSuccess:
604+
indexStatus = "success"
601605
case model.CodegraphStatusInit:
602606
indexStatus = "pending"
603607
default:

0 commit comments

Comments
 (0)