Fix to chunk loading policy.

This commit is contained in:
gmp
2026-06-05 18:06:17 -04:00
parent b224bbe85a
commit 4052769813
5 changed files with 122 additions and 41 deletions
+1
View File
@@ -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.
+9 -1
View File
@@ -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 }