Skip to content

Commit

Permalink
Config findProviderTimeout through client
Browse files Browse the repository at this point in the history
  • Loading branch information
gammazero committed Nov 22, 2024
1 parent 84f8f13 commit 7409ebe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions bitswap/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ func New(parent context.Context, network bsnet.BitSwapNetwork, bstore blockstore
bpm := bsbpm.New()
pm := bspm.New(ctx, peerQueueFactory, network.Self())
pqm := bspqm.New(ctx, network,
bspqm.WithFindProviderTimeout(opts.findProviderTimeout),
bspqm.WithMaxConcurrentFinds(opts.maxConcurrentFinds),
bspqm.WithMaxProvidersPerFind(opts.maxProvidersPerFind))

Expand Down
7 changes: 7 additions & 0 deletions bitswap/client/optios.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type clientConfig struct {
tracer tracer.Tracer

// ProviderQueryManager options.
findProviderTimeout time.Duration
maxConcurrentFinds int
maxProvidersPerFind int
}
Expand Down Expand Up @@ -92,6 +93,12 @@ func WithoutDuplicatedBlockStats() Option {
}
}

func WithFindProviderTimeout(to time.Duration) Option {
return func(c *clientConfig) {
c.findProviderTimeout = to
}
}

func WithMaxConcurrentFinds(n int) Option {
return func(c *clientConfig) {
c.maxConcurrentFinds = n
Expand Down

0 comments on commit 7409ebe

Please sign in to comment.