Skip to content

Commit 462f099

Browse files
committed
refactor: optimize log output levels and content
1 parent 922eb60 commit 462f099

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

internal/service/embedding_status.go

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ func (sc *embeddingStatusService) checkWorkspaceBuildingStates(workspacePath str
144144
sc.logger.Error("failed to fetch file status for syncId %s: %v", syncId, err)
145145
continue
146146
}
147+
sc.logger.Info("syncId %s file status resp: %v", syncId, fileStatusResp)
147148

148149
// 批量处理该syncId下的所有事件
149150
if err := sc.processEventsWithFileStatus(workspacePath, syncIdEvents, fileStatusResp); err != nil {
@@ -258,23 +259,16 @@ func (sc *embeddingStatusService) processEventsWithFileStatus(workspacePath stri
258259
return nil
259260
}
260261

261-
syncId := events[0].SyncId
262-
sc.logger.Info("processing build status for syncId: %s, %d events", syncId, len(events))
263-
264262
fileStatusData := fileStatusResp.Data
265263
processStatus := fileStatusData.Process
266264

267-
sc.logger.Debug("processing file status for syncId %s: process=%s", syncId, processStatus)
268-
269265
// 当process为pending时,不处理
270266
if processStatus == dto.EmbeddingStatusPending {
271-
sc.logger.Info("build is pending for syncId: %s", syncId)
272267
return nil
273268
}
274269

275270
// 当process为failed时,将所有事件的embeddingstatus改为failed
276271
if processStatus == dto.EmbeddingFailed {
277-
sc.logger.Info("build failed for syncId: %s", syncId)
278272
// 构建失败,批量更新事件状态为构建失败
279273
eventIDs := make([]int64, 0, len(events))
280274
for _, event := range events {
@@ -288,7 +282,6 @@ func (sc *embeddingStatusService) processEventsWithFileStatus(workspacePath stri
288282
}
289283

290284
// 其他情况保持原来的处理逻辑,批量处理构建完成
291-
sc.logger.Debug("build completed for syncId: %s", syncId)
292285
return sc.batchHandleBuildCompletion(workspacePath, events, fileStatusData.FileList)
293286
}
294287

@@ -512,18 +505,18 @@ func (sc *embeddingStatusService) batchHandleBuildCompletion(workspacePath strin
512505
var status string
513506
if fileStatus, exists := fileStatusMap[filePath]; exists {
514507
status = fileStatus
515-
sc.logger.Info("file %s status: %s", filePath, fileStatus)
508+
sc.logger.Debug("file %s status: %s, syncId: %s", filePath, fileStatus, event.SyncId)
516509
}
517510

518511
// 更新事件状态
519512
updateEvent := &model.Event{ID: event.ID}
520513
switch status {
521514
case dto.EmbeddingComplete, dto.EmbeddingUnsupported:
522515
updateEvent.EmbeddingStatus = model.EmbeddingStatusSuccess
523-
sc.logger.Info("file %s built successfully for syncId: %s", filePath, event.SyncId)
516+
sc.logger.Debug("file %s built successfully for syncId: %s", filePath, event.SyncId)
524517
case dto.EmbeddingFailed:
525518
updateEvent.EmbeddingStatus = model.EmbeddingStatusBuildFailed
526-
sc.logger.Info("file %s failed to build for syncId: %s", filePath, event.SyncId)
519+
sc.logger.Debug("file %s failed to build for syncId: %s", filePath, event.SyncId)
527520
default:
528521
continue
529522
}

internal/service/upload_service.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,8 +969,6 @@ func (us *uploadService) isRetryableError(err error) bool {
969969

970970
// 网络相关错误可重试
971971
if strings.Contains(errStr, "timeout") ||
972-
strings.Contains(errStr, "connection refused") ||
973-
strings.Contains(errStr, "network is unreachable") ||
974972
strings.Contains(errStr, "connection reset") {
975973
return true
976974
}

0 commit comments

Comments
 (0)