From a48561876a6045c10ef42751064cd49001a3439c Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Wed, 22 Jun 2022 17:10:35 +0100 Subject: [PATCH 1/4] feat: remove provider delay interval in bitswap --- core/node/bitswap.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/node/bitswap.go b/core/node/bitswap.go index 2b9cf641a1b..6100f3aa087 100644 --- a/core/node/bitswap.go +++ b/core/node/bitswap.go @@ -40,6 +40,7 @@ func BitswapOptions(cfg *config.Config, provide bool) interface{} { opts := []bitswap.Option{ bitswap.ProvideEnabled(provide), + bitswap.ProviderSearchDelay(0), // 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))), From 64a8a76ccd572ba91bfb0c61a0bda0e781763912 Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Wed, 22 Jun 2022 17:22:15 +0100 Subject: [PATCH 2/4] Use a non-zero provider search delay --- core/node/bitswap.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/node/bitswap.go b/core/node/bitswap.go index 6100f3aa087..07256b1dced 100644 --- a/core/node/bitswap.go +++ b/core/node/bitswap.go @@ -2,6 +2,7 @@ package node import ( "context" + "time" "github.com/ipfs/go-bitswap" "github.com/ipfs/go-bitswap/network" @@ -21,6 +22,7 @@ const ( DefaultTaskWorkerCount = 8 DefaultEngineTaskWorkerCount = 8 DefaultMaxOutstandingBytesPerPeer = 1 << 20 + DefaultProviderSearchDelay = 20 * time.Millisecond ) type bitswapOptionsOut struct { @@ -40,7 +42,7 @@ func BitswapOptions(cfg *config.Config, provide bool) interface{} { opts := []bitswap.Option{ bitswap.ProvideEnabled(provide), - bitswap.ProviderSearchDelay(0), // See https://github.com/ipfs/go-ipfs/issues/8807 for rationale + bitswap.ProviderSearchDelay(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))), From 4813df1b98ad024cfc62a74465f93f2a6ee07f64 Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Wed, 17 Aug 2022 10:52:33 +0100 Subject: [PATCH 3/4] Add ProviderSearchDelay to Internal.Bitswap config --- config/internal.go | 1 + core/node/bitswap.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config/internal.go b/config/internal.go index dcd834e701c..a860c02c9cc 100644 --- a/config/internal.go +++ b/config/internal.go @@ -12,4 +12,5 @@ type InternalBitswap struct { EngineBlockstoreWorkerCount OptionalInteger EngineTaskWorkerCount OptionalInteger MaxOutstandingBytesPerPeer OptionalInteger + ProviderSearchDelay OptionalDuration } diff --git a/core/node/bitswap.go b/core/node/bitswap.go index 07256b1dced..9f8ef0c38dd 100644 --- a/core/node/bitswap.go +++ b/core/node/bitswap.go @@ -42,7 +42,7 @@ func BitswapOptions(cfg *config.Config, provide bool) interface{} { opts := []bitswap.Option{ bitswap.ProvideEnabled(provide), - bitswap.ProviderSearchDelay(DefaultProviderSearchDelay), // See https://github.com/ipfs/go-ipfs/issues/8807 for rationale + 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))), From 566585980b9c770a45b649b7fce19b81e255eccf Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Mon, 26 Sep 2022 14:57:05 +0100 Subject: [PATCH 4/4] Revert bitswap provider delay to 1s --- core/node/bitswap.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/node/bitswap.go b/core/node/bitswap.go index 9f8ef0c38dd..42b948f7520 100644 --- a/core/node/bitswap.go +++ b/core/node/bitswap.go @@ -22,7 +22,7 @@ const ( DefaultTaskWorkerCount = 8 DefaultEngineTaskWorkerCount = 8 DefaultMaxOutstandingBytesPerPeer = 1 << 20 - DefaultProviderSearchDelay = 20 * time.Millisecond + DefaultProviderSearchDelay = 1000 * time.Millisecond ) type bitswapOptionsOut struct {