Fix to chunk loading policy.
This commit is contained in:
@@ -14,6 +14,7 @@ type Result struct {
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
DirPath string `json:"dir_path,omitempty"`
|
||||
FilePath string `json:"file_path,omitempty"` // Added
|
||||
ChunkIdx int `json:"chunk_idx,omitempty"` // Added to uniquely identify chunk result
|
||||
}
|
||||
|
||||
// IsSuccess returns true if the task completed successfully.
|
||||
|
||||
@@ -147,7 +147,15 @@ func (t *ReadChunkTask) Execute() Result {
|
||||
return Result{TaskID: t.taskID, TaskType: TypeReadChunk, FilePath: t.Path, Success: false, Error: fmt.Errorf("failed to read chunk %d: %w", t.ChunkIdx, err)}
|
||||
}
|
||||
|
||||
return Result{TaskID: t.taskID, TaskType: TypeReadChunk, FilePath: t.Path, Success: true, Data: chunk}
|
||||
return Result{
|
||||
TaskID: t.taskID,
|
||||
TaskType: TypeReadChunk,
|
||||
FilePath: t.Path,
|
||||
Success: true,
|
||||
Data: chunk,
|
||||
ChunkIdx: t.ChunkIdx, // Explicitly pass the chunk index
|
||||
Timestamp: time.Now(),
|
||||
}
|
||||
}
|
||||
|
||||
func (t *ReadChunkTask) Priority() Priority { return HighPriority }
|
||||
|
||||
Reference in New Issue
Block a user