@cryptotaxi247 / kubo / commits / e80dadd1a

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 e80dadd1a4dd543b2e15af4f22f5b4045724a098
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
@@ -125,7 +125,7 @@ require (
125 github.com/libp2p/go-libp2p-pubsub v0.9.0 // indirect
126 github.com/libp2p/go-libp2p-pubsub-router v0.6.0 // indirect
127 github.com/libp2p/go-libp2p-record v0.2.0 // indirect
128 - github.com/libp2p/go-libp2p-routing-helpers v0.6.1 // indirect
128 + github.com/libp2p/go-libp2p-routing-helpers v0.6.2 // indirect
129 github.com/libp2p/go-libp2p-xor v0.1.0 // indirect
130 github.com/libp2p/go-mplex v0.7.0 // indirect
131 github.com/libp2p/go-msgio v0.3.0 // indirect
docs/examples/kubo-as-a-library/go.sum
+2 -2
@@ -809,8 +809,8 @@ github.com/libp2p/go-libp2p-quic-transport v0.10.0/go.mod h1:RfJbZ8IqXIhxBRm5hqU
809 github.com/libp2p/go-libp2p-record v0.1.0/go.mod h1:ujNc8iuE5dlKWVy6wuL6dd58t0n7xI4hAIl8pE6wu5Q=
810 github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0=
811 github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk=
812 -github.com/libp2p/go-libp2p-routing-helpers v0.6.1 h1:tI3rHOf/FDQsxC2pHBaOZiqPJ0MZYyzGAf4V45xla4U=
813 -github.com/libp2p/go-libp2p-routing-helpers v0.6.1/go.mod h1:R289GUxUMzRXIbWGSuUUTPrlVJZ3Y/pPz495+qgXJX8=
812 +github.com/libp2p/go-libp2p-routing-helpers v0.6.2 h1:u6SWfX+3LoqqTAFxWVl79RkcIDE3Zsay5d+JohlEBaE=
813 +github.com/libp2p/go-libp2p-routing-helpers v0.6.2/go.mod h1:R289GUxUMzRXIbWGSuUUTPrlVJZ3Y/pPz495+qgXJX8=
814 github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8=
815 github.com/libp2p/go-libp2p-secio v0.2.0/go.mod h1:2JdZepB8J5V9mBp79BmwsaPQhRPNN2NrnB2lKQcdy6g=
816 github.com/libp2p/go-libp2p-secio v0.2.1/go.mod h1:cWtZpILJqkqrSkiYcDBh5lA3wbT2Q+hz3rJQq3iftD8=
go.mod
+1 -1
@@ -74,7 +74,7 @@ require (
74 github.com/libp2p/go-libp2p-pubsub v0.9.0
75 github.com/libp2p/go-libp2p-pubsub-router v0.6.0
76 github.com/libp2p/go-libp2p-record v0.2.0
77 - github.com/libp2p/go-libp2p-routing-helpers v0.6.1
77 + github.com/libp2p/go-libp2p-routing-helpers v0.6.2
78 github.com/libp2p/go-libp2p-testing v0.12.0
79 github.com/libp2p/go-socket-activation v0.1.0
80 github.com/miekg/dns v1.1.50
go.sum
+2 -2
@@ -843,8 +843,8 @@ github.com/libp2p/go-libp2p-quic-transport v0.10.0/go.mod h1:RfJbZ8IqXIhxBRm5hqU
843 github.com/libp2p/go-libp2p-record v0.1.0/go.mod h1:ujNc8iuE5dlKWVy6wuL6dd58t0n7xI4hAIl8pE6wu5Q=
844 github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0=
845 github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk=
846 -github.com/libp2p/go-libp2p-routing-helpers v0.6.1 h1:tI3rHOf/FDQsxC2pHBaOZiqPJ0MZYyzGAf4V45xla4U=
847 -github.com/libp2p/go-libp2p-routing-helpers v0.6.1/go.mod h1:R289GUxUMzRXIbWGSuUUTPrlVJZ3Y/pPz495+qgXJX8=
846 +github.com/libp2p/go-libp2p-routing-helpers v0.6.2 h1:u6SWfX+3LoqqTAFxWVl79RkcIDE3Zsay5d+JohlEBaE=
847 +github.com/libp2p/go-libp2p-routing-helpers v0.6.2/go.mod h1:R289GUxUMzRXIbWGSuUUTPrlVJZ3Y/pPz495+qgXJX8=
848 github.com/libp2p/go-libp2p-secio v0.1.0/go.mod h1:tMJo2w7h3+wN4pgU2LSYeiKPrfqBgkOsdiKK77hE7c8=
849 github.com/libp2p/go-libp2p-secio v0.2.0/go.mod h1:2JdZepB8J5V9mBp79BmwsaPQhRPNN2NrnB2lKQcdy6g=
850 github.com/libp2p/go-libp2p-secio v0.2.1/go.mod h1:cWtZpILJqkqrSkiYcDBh5lA3wbT2Q+hz3rJQq3iftD8=