From 06ead39ecd1cbbf77f212b5f632b202184913b3e Mon Sep 17 00:00:00 2001 From: gammazero Date: Fri, 8 Dec 2023 00:18:47 -0800 Subject: [PATCH] Fix default indexer URL --- ipni-gc/cmd/ipnigc/provider.go | 4 +++- ipni-gc/reaper/reaper.go | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ipni-gc/cmd/ipnigc/provider.go b/ipni-gc/cmd/ipnigc/provider.go index 998bfd8ee..b2a64cbbd 100644 --- a/ipni-gc/cmd/ipnigc/provider.go +++ b/ipni-gc/cmd/ipnigc/provider.go @@ -18,6 +18,8 @@ import ( var log = logging.Logger("ipni-gc") +const defaultIndexerURL = "http://localhost:3000" + var providerCmd = &cli.Command{ Name: "provider", Usage: "Run ipni garbage collection for specified providers", @@ -94,7 +96,7 @@ func providerAction(cctx *cli.Context) error { indexerURLs := cctx.StringSlice("indexer") if len(indexerURLs) == 0 { - indexerURLs = []string{"htto://localhost:3000"} + indexerURLs = []string{defaultIndexerURL} } dsDir, err := config.Path("", cfg.Datastore.Dir+"-gc") diff --git a/ipni-gc/reaper/reaper.go b/ipni-gc/reaper/reaper.go index c4738b107..3af872fa7 100644 --- a/ipni-gc/reaper/reaper.go +++ b/ipni-gc/reaper/reaper.go @@ -381,7 +381,7 @@ func (s *scythe) reap(ctx context.Context, latestAdCid cid.Cid) error { } else { _, ok := removedCtxSet[contextID] if ok { - log.Debugw("GC removed index content ad", "adCid", adCid) + log.Debugw("GC removing index content ad", "adCid", adCid) s.stats.IndexAdsRemoved++ // Ad's context ID is removed, so delete all multihashes for ad. if err = s.deleteEntries(ctx, adCid); err != nil { @@ -438,7 +438,11 @@ func (s *scythe) reapPrevRemaining(ctx context.Context, contextID string) error commit := s.reaper.commit - log.Debugw("Deleting indexes from previously processed ads that have removed contextID", "count", len(ents)) + if len(ents) == 0 { + return nil + } + + log.Debugw("Deleting indexes from previously processed ads that have removed contextID", "ads", len(ents)) for i := range ents { key := ents[i].Key adCid, err := cid.Decode(path.Base(key))