feat: reprocess all command

This commit is contained in:
2026-06-28 00:40:50 +05:00
parent 1e71b94fdb
commit 30f7ae1e07
3 changed files with 74 additions and 8 deletions

View File

@@ -253,6 +253,35 @@ func (s *DatasetService) Reprocess(ctx context.Context, id uuid.UUID) (domain.Da
return dataset, nil
}
// ReprocessAll re-enqueues the processing job for every dataset, restarting each
// one's asynchronous pipeline from the step appropriate to its file type. It
// paginates through all datasets and continues past individual failures,
// returning how many jobs were enqueued and a per-dataset map of any failures.
func (s *DatasetService) ReprocessAll(ctx context.Context) (enqueued int, failures map[uuid.UUID]error, err error) {
failures = make(map[uuid.UUID]error)
for offset := 0; ; {
summaries, err := s.repo.ListSummaries(ctx, nil, MaxPageSize, offset)
if err != nil {
return enqueued, failures, err
}
if len(summaries) == 0 {
break
}
for _, sum := range summaries {
if e := s.enqueueProcessing(ctx, domain.Dataset{ID: sum.ID, FileType: sum.FileType}); e != nil {
failures[sum.ID] = e
continue
}
enqueued++
}
if len(summaries) < MaxPageSize {
break
}
offset += len(summaries)
}
return enqueued, failures, nil
}
// ExtractProperties reads a plain vector dataset's attribute table and spatial
// geometry and stores them (the attribute table as a JSON array of row objects
// in the properties column, the dissolved feature geometry in the geometry