MCPcopy Create free account
hub / github.com/53AI/53AIHub / resetFileForReupload

Method resetFileForReupload

api/service/error_handler.go:113–137  ·  view source on GitHub ↗

resetFileForReupload 重置文件状态为可重新上传

(batchID, fileID string)

Source from the content-addressed store, hash-verified

111
112// resetFileForReupload 重置文件状态为可重新上传
113func (h *ErrorHandler) resetFileForReupload(batchID, fileID string) error {
114 batch, err := h.batchManager.GetBatch(batchID)
115 if err != nil {
116 return fmt.Errorf("获取批次失败: %v", err)
117 }
118
119 batch.mu.Lock()
120 if fileUpload, exists := batch.Files[fileID]; exists {
121 // 重置为队列状态,允许重新上传
122 fileUpload.Status = "queued"
123 fileUpload.Error = ""
124 fileUpload.Progress = 0
125 fileUpload.UploadedSize = 0
126 fileUpload.DatabaseID = 0
127 fileUpload.FileID = 0
128
129 // 更新进度(在持有 batch 锁的情况下安全修改)
130 // Fix: Use updateFileProgressNoLock to avoid deadlock since we already hold the lock
131 h.batchManager.updateFileProgressNoLock(batch, fileID, fileUpload)
132
133 log.Printf("已重置文件状态为可重新上传: BatchID=%s, FileID=%s", batchID, fileID)
134 }
135 batch.mu.Unlock()
136 return nil
137}
138
139// CleanupFailedBatch 清理失败的批次
140func (h *ErrorHandler) CleanupFailedBatch(batchID string) error {

Callers 1

Calls 5

GetBatchMethod · 0.80
ErrorfMethod · 0.80
PrintfMethod · 0.80
UnlockMethod · 0.65

Tested by

no test coverage detected