Log snapshot listing failures

This commit is contained in:
Mikei386
2026-07-10 13:01:16 +02:00
parent bf06b10519
commit 3f1b7cd781
10 changed files with 76 additions and 19 deletions
+9 -1
View File
@@ -385,16 +385,24 @@ func (s *Service) RepositoryStats(ctx context.Context) []model.RepositoryStats {
}
func (s *Service) SnapshotFiles(ctx context.Context, repoID, snapshot, path string) ([]map[string]any, error) {
started := time.Now()
repo, ok := s.repository(repoID)
if !ok {
return nil, errors.New("validation: unknown repository")
}
mounted, err := s.mounts.Prepare(ctx, repo)
if err != nil {
s.log.Warn("snapshot file listing failed", "repoID", repoID, "snapshot", snapshot, "path", path, "durationMs", time.Since(started).Milliseconds(), "error", err)
return nil, err
}
defer s.mounts.Cleanup(context.Background(), mounted)
return s.restic.List(ctx, mounted.Repository, snapshot, path)
items, err := s.restic.List(ctx, mounted.Repository, snapshot, path)
if err != nil {
s.log.Warn("snapshot file listing failed", "repoID", repoID, "snapshot", snapshot, "path", path, "durationMs", time.Since(started).Milliseconds(), "error", err)
return nil, err
}
s.log.Info("snapshot file listing loaded", "repoID", repoID, "snapshot", snapshot, "path", path, "items", len(items), "durationMs", time.Since(started).Milliseconds())
return items, nil
}
func (s *Service) TestRepository(ctx context.Context, repoID string, initialize bool) error {