Skip to content

Commit

Permalink
feat: remove provider delay interval in bitswap (#9053)
Browse files Browse the repository at this point in the history
* feat: remove provider delay interval in bitswap

* Use a non-zero provider search delay

* Add ProviderSearchDelay to Internal.Bitswap config

* Revert bitswap provider delay to 1s
  • Loading branch information
iand authored Oct 13, 2022
1 parent bf8274f commit 066a0b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ type InternalBitswap struct {
EngineBlockstoreWorkerCount OptionalInteger
EngineTaskWorkerCount OptionalInteger
MaxOutstandingBytesPerPeer OptionalInteger
ProviderSearchDelay OptionalDuration
}
3 changes: 3 additions & 0 deletions core/node/bitswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package node

import (
"context"
"time"

"github.com/ipfs/go-bitswap"
"github.com/ipfs/go-bitswap/network"
Expand All @@ -21,6 +22,7 @@ const (
DefaultTaskWorkerCount = 8
DefaultEngineTaskWorkerCount = 8
DefaultMaxOutstandingBytesPerPeer = 1 << 20
DefaultProviderSearchDelay = 1000 * time.Millisecond
)

type bitswapOptionsOut struct {
Expand All @@ -40,6 +42,7 @@ func BitswapOptions(cfg *config.Config, provide bool) interface{} {

opts := []bitswap.Option{
bitswap.ProvideEnabled(provide),
bitswap.ProviderSearchDelay(internalBsCfg.ProviderSearchDelay.WithDefault(DefaultProviderSearchDelay)), // See https://github.com/ipfs/go-ipfs/issues/8807 for rationale
bitswap.EngineBlockstoreWorkerCount(int(internalBsCfg.EngineBlockstoreWorkerCount.WithDefault(DefaultEngineBlockstoreWorkerCount))),
bitswap.TaskWorkerCount(int(internalBsCfg.TaskWorkerCount.WithDefault(DefaultTaskWorkerCount))),
bitswap.EngineTaskWorkerCount(int(internalBsCfg.EngineTaskWorkerCount.WithDefault(DefaultEngineTaskWorkerCount))),
Expand Down

0 comments on commit 066a0b9

Please sign in to comment.