@cryptotaxi247 / kubo / commits / a09c8df24

fix: remove timeout on default DHT operations (#9783)

* fix: remove timeout on default DHT operations This removes the timeout by default for DHT operations. In particular this causes issues with ProvideMany requests which can take an indeterminate amount of time, but really these should just respect context timeouts by default. Users can still specify timeouts here if they want, but by default they will be set to "0" which means "no timeout". This is unlikely to break existing users of custom routing, because there was previously no utility in configuring a router with timeout=0 because that would cause the router to immediately fail, so it is unlikely (and incorrect) if anybody was using timeout=0. * fix: remove 5m timeout on ProvideManyRouter For context see https://github.com/ipfs/kubo/pull/9783/commits/5fda291b6665abe7aaf6a3f17687474dc85d8db4 --------- Co-authored-by: Marcin Rataj <lidel@lidel.org>

Gus Eggert committed Mar 30, 2023 at 16:08 UTC a09c8df24d2eaac3ce99c4e6184f47bb218193cf
6 files changed +6 -8
core/node/libp2p/routing.go
-1
@@ -186,7 +186,6 @@ func Routing(in p2pOnlineRoutingIn) irouting.ProvideManyRouter {
186 var cRouters []*routinghelpers.ParallelRouter
187 for _, v := range routers {
188 cRouters = append(cRouters, &routinghelpers.ParallelRouter{
189 - Timeout: 5 * time.Minute,
189 IgnoreError: true,
190 Router: v.Routing,
191 })
core/node/libp2p/routingopt.go
-1
@@ -65,7 +65,6 @@ func ConstructDefaultRouting(peerID string, addrs []string, privKey string, rout
65 routers = append(routers, &routinghelpers.ParallelRouter{
66 Router: dhtRouting,
67 IgnoreError: false,
68 - Timeout: 5 * time.Minute, // https://github.com/ipfs/kubo/pull/9475#discussion_r1042501333
68 ExecuteAfter: 0,
69 })
70
docs/examples/kubo-as-a-library/go.mod
+1 -1
@@ -108,7 +108,7 @@ require (
108 github.com/libp2p/go-libp2p-pubsub v0.9.0 // indirect
109 github.com/libp2p/go-libp2p-pubsub-router v0.6.0 // indirect
110 github.com/libp2p/go-libp2p-record v0.2.0 // indirect
111 - github.com/libp2p/go-libp2p-routing-helpers v0.6.1 // indirect
111 + github.com/libp2p/go-libp2p-routing-helpers v0.6.2 // indirect
112 github.com/libp2p/go-libp2p-xor v0.1.0 // indirect
113 github.com/libp2p/go-mplex v0.7.0 // indirect
114 github.com/libp2p/go-msgio v0.3.0 // indirect
docs/examples/kubo-as-a-library/go.sum
+2 -2
@@ -530,8 +530,8 @@ github.com/libp2p/go-libp2p-pubsub-router v0.6.0 h1:D30iKdlqDt5ZmLEYhHELCMRj8b4s
530 github.com/libp2p/go-libp2p-pubsub-router v0.6.0/go.mod h1:FY/q0/RBTKsLA7l4vqC2cbRbOvyDotg8PJQ7j8FDudE=
531 github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0=
532 github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk=
533 -github.com/libp2p/go-libp2p-routing-helpers v0.6.1 h1:tI3rHOf/FDQsxC2pHBaOZiqPJ0MZYyzGAf4V45xla4U=
534 -github.com/libp2p/go-libp2p-routing-helpers v0.6.1/go.mod h1:R289GUxUMzRXIbWGSuUUTPrlVJZ3Y/pPz495+qgXJX8=
533 +github.com/libp2p/go-libp2p-routing-helpers v0.6.2 h1:u6SWfX+3LoqqTAFxWVl79RkcIDE3Zsay5d+JohlEBaE=
534 +github.com/libp2p/go-libp2p-routing-helpers v0.6.2/go.mod h1:R289GUxUMzRXIbWGSuUUTPrlVJZ3Y/pPz495+qgXJX8=
535 github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
536 github.com/libp2p/go-libp2p-xor v0.1.0 h1:hhQwT4uGrBcuAkUGXADuPltalOdpf9aag9kaYNT2tLA=
537 github.com/libp2p/go-libp2p-xor v0.1.0/go.mod h1:LSTM5yRnjGZbWNTA/hRwq2gGFrvRIbQJscoIL/u6InY=
go.mod
+1 -1
@@ -52,7 +52,7 @@ require (
52 github.com/libp2p/go-libp2p-pubsub v0.9.0
53 github.com/libp2p/go-libp2p-pubsub-router v0.6.0
54 github.com/libp2p/go-libp2p-record v0.2.0
55 - github.com/libp2p/go-libp2p-routing-helpers v0.6.1
55 + github.com/libp2p/go-libp2p-routing-helpers v0.6.2
56 github.com/libp2p/go-libp2p-testing v0.12.0
57 github.com/libp2p/go-socket-activation v0.1.0
58 github.com/mitchellh/go-homedir v1.1.0
go.sum
+2 -2
@@ -562,8 +562,8 @@ github.com/libp2p/go-libp2p-pubsub-router v0.6.0 h1:D30iKdlqDt5ZmLEYhHELCMRj8b4s
562 github.com/libp2p/go-libp2p-pubsub-router v0.6.0/go.mod h1:FY/q0/RBTKsLA7l4vqC2cbRbOvyDotg8PJQ7j8FDudE=
563 github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0=
564 github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk=
565 -github.com/libp2p/go-libp2p-routing-helpers v0.6.1 h1:tI3rHOf/FDQsxC2pHBaOZiqPJ0MZYyzGAf4V45xla4U=
566 -github.com/libp2p/go-libp2p-routing-helpers v0.6.1/go.mod h1:R289GUxUMzRXIbWGSuUUTPrlVJZ3Y/pPz495+qgXJX8=
565 +github.com/libp2p/go-libp2p-routing-helpers v0.6.2 h1:u6SWfX+3LoqqTAFxWVl79RkcIDE3Zsay5d+JohlEBaE=
566 +github.com/libp2p/go-libp2p-routing-helpers v0.6.2/go.mod h1:R289GUxUMzRXIbWGSuUUTPrlVJZ3Y/pPz495+qgXJX8=
567 github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
568 github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg=
569 github.com/libp2p/go-libp2p-xor v0.1.0 h1:hhQwT4uGrBcuAkUGXADuPltalOdpf9aag9kaYNT2tLA=