Skip to content

Commit

Permalink
No IndexCount, do not auto-refresh pcache
Browse files Browse the repository at this point in the history
  • Loading branch information
gammazero committed Jul 14, 2023
1 parent 9171e4d commit 9b6f396
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ func providerAction(cctx *cli.Context) error {
var pc *pcache.ProviderCache
var err error
if len(peerIDs) > 1 {
pc, err = pcache.New(pcache.WithSourceURL(cctx.StringSlice("indexer")...))
pc, err = pcache.New(pcache.WithRefreshInterval(0),
pcache.WithSourceURL(cctx.StringSlice("indexer")...))
} else {
pc, err = pcache.New(pcache.WithPreload(false), pcache.WithSourceURL(cctx.StringSlice("indexer")...))
pc, err = pcache.New(pcache.WithPreload(false), pcache.WithRefreshInterval(0),
pcache.WithSourceURL(cctx.StringSlice("indexer")...))
}
if err != nil {
return err
Expand Down Expand Up @@ -173,7 +175,8 @@ func getProvider(cctx *cli.Context, pc *pcache.ProviderCache, peerID peer.ID) er
}

func countProviders(cctx *cli.Context) error {
pcache, err := pcache.New(pcache.WithSourceURL(cctx.StringSlice("indexer")...))
pcache, err := pcache.New(pcache.WithRefreshInterval(0),
pcache.WithSourceURL(cctx.StringSlice("indexer")...))
if err != nil {
return err
}
Expand All @@ -183,7 +186,8 @@ func countProviders(cctx *cli.Context) error {
}

func listProviders(cctx *cli.Context, peerIDs []peer.ID) error {
pc, err := pcache.New(pcache.WithSourceURL(cctx.StringSlice("indexer")...))
pc, err := pcache.New(pcache.WithRefreshInterval(0),
pcache.WithSourceURL(cctx.StringSlice("indexer")...))
if err != nil {
return err
}
Expand Down Expand Up @@ -253,7 +257,7 @@ func showProviderInfo(cctx *cli.Context, pinfo *model.ProviderInfo) {
if pinfo.FrozenAtTime != "" {
fmt.Println(" FrozenAtTime:", pinfo.FrozenAtTime)
}
fmt.Println(" IndexCount:", pinfo.IndexCount)

if pinfo.Inactive {
fmt.Println(" Inactive: true")
}
Expand Down

0 comments on commit 9b6f396

Please sign in to comment.