Skip to content

Commit

Permalink
fix usage of ImportNewRepo
Browse files Browse the repository at this point in the history
  • Loading branch information
brianolson committed Dec 17, 2024
1 parent 106172e commit 994cce3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion indexer/repofetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ func (rf *RepoFetcher) FetchAndIndexRepo(ctx context.Context, job *crawlWork) er
}
}

revp := &rev
if rev == "" {
span.SetAttributes(attribute.Bool("full", true))
revp = nil
}

c := models.ClientForPds(&pds)
Expand All @@ -174,7 +176,7 @@ func (rf *RepoFetcher) FetchAndIndexRepo(ctx context.Context, job *crawlWork) er
return err
}

if err := rf.repoman.ImportNewRepo(ctx, ai.Uid, ai.Did, bytes.NewReader(repo), &rev); err != nil {
if err := rf.repoman.ImportNewRepo(ctx, ai.Uid, ai.Did, bytes.NewReader(repo), revp); err != nil {
span.RecordError(err)

if ipld.IsNotFound(err) || errors.Is(err, io.EOF) || errors.Is(err, fs.ErrNotExist) {
Expand Down
3 changes: 3 additions & 0 deletions repomgr/repomgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,9 @@ func (rm *RepoManager) ImportNewRepo(ctx context.Context, user models.Uid, repoD
return err
}

if rev != nil && *rev == "" {
rev = nil
}
if rev == nil {
// if 'rev' is nil, this implies a fresh sync.
// in this case, ignore any existing blocks we have and treat this like a clean import.
Expand Down

0 comments on commit 994cce3

Please sign in to comment.