Skip to content

Commit

Permalink
routing: bring back the old IPNS behaviour
Browse files Browse the repository at this point in the history
Stop making this configurable let everything race like it used to do.
  • Loading branch information
Jorropo committed Jul 25, 2023
1 parent 19ed4f3 commit 77ecec5
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
10 changes: 4 additions & 6 deletions core/node/libp2p/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ import (
type Router struct {
routing.Routing

Priority int // less = more important
DoNotWaitForIPNS bool
Priority int // less = more important
}

type p2pRouterOut struct {
Expand Down Expand Up @@ -127,7 +126,7 @@ func BaseRouting(cfg *config.Config) interface{} {
return out, err
}
routers := []*routinghelpers.ParallelRouter{
{Router: fullRTClient},
{Router: fullRTClient, DoNotWaitForSearchValue: true},
}
routers = append(routers, httpRouters...)
router := routinghelpers.NewComposableParallel(routers)
Expand Down Expand Up @@ -199,7 +198,7 @@ func Routing(in p2pOnlineRoutingIn) irouting.ProvideManyRouter {
for _, v := range routers {
cRouters = append(cRouters, &routinghelpers.ParallelRouter{
IgnoreError: true,
DoNotWaitForSearchValue: v.DoNotWaitForIPNS,
DoNotWaitForSearchValue: true,
Router: v.Routing,
})
}
Expand Down Expand Up @@ -246,8 +245,7 @@ func PubsubRouter(mctx helpers.MetricsCtx, lc fx.Lifecycle, in p2pPSRoutingIn) (
Namespaces: []string{"ipns"},
},
},
Priority: 100,
DoNotWaitForIPNS: true,
Priority: 100,
},
}, psRouter, nil
}
Expand Down
16 changes: 9 additions & 7 deletions core/node/libp2p/routingopt.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ func constructDefaultHTTPRouters(cfg *config.Config) ([]*routinghelpers.Parallel
}

routers = append(routers, &routinghelpers.ParallelRouter{
Router: r,
IgnoreError: true, // https://github.com/ipfs/kubo/pull/9475#discussion_r1042507387
Timeout: 15 * time.Second, // 5x server value from https://github.com/ipfs/kubo/pull/9475#discussion_r1042428529
ExecuteAfter: 0,
Router: r,
IgnoreError: true, // https://github.com/ipfs/kubo/pull/9475#discussion_r1042507387
Timeout: 15 * time.Second, // 5x server value from https://github.com/ipfs/kubo/pull/9475#discussion_r1042428529
DoNotWaitForSearchValue: true,
ExecuteAfter: 0,
})
}
return routers, nil
Expand All @@ -82,9 +83,10 @@ func ConstructDefaultRouting(cfg *config.Config, routingOpt RoutingOption) Routi
return nil, err
}
routers = append(routers, &routinghelpers.ParallelRouter{
Router: dhtRouting,
IgnoreError: false,
ExecuteAfter: 0,
Router: dhtRouting,
IgnoreError: false,
DoNotWaitForSearchValue: true,
ExecuteAfter: 0,
})

httpRouters, err := constructDefaultHTTPRouters(cfg)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/kubo-as-a-library/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ require (
github.com/libp2p/go-libp2p-pubsub v0.9.3 // indirect
github.com/libp2p/go-libp2p-pubsub-router v0.6.0 // indirect
github.com/libp2p/go-libp2p-record v0.2.0 // indirect
github.com/libp2p/go-libp2p-routing-helpers v0.7.1-0.20230724133210-850d18ac98d2 // indirect
github.com/libp2p/go-libp2p-routing-helpers v0.7.1 // indirect
github.com/libp2p/go-libp2p-xor v0.1.0 // indirect
github.com/libp2p/go-mplex v0.7.0 // indirect
github.com/libp2p/go-msgio v0.3.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/kubo-as-a-library/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,8 @@ github.com/libp2p/go-libp2p-pubsub-router v0.6.0 h1:D30iKdlqDt5ZmLEYhHELCMRj8b4s
github.com/libp2p/go-libp2p-pubsub-router v0.6.0/go.mod h1:FY/q0/RBTKsLA7l4vqC2cbRbOvyDotg8PJQ7j8FDudE=
github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0=
github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk=
github.com/libp2p/go-libp2p-routing-helpers v0.7.1-0.20230724133210-850d18ac98d2 h1:vrpRNp4Op39bYYqPQjfwTU341Kckpmbp4QIvKitw37I=
github.com/libp2p/go-libp2p-routing-helpers v0.7.1-0.20230724133210-850d18ac98d2/go.mod h1:cHStPSRC/wgbfpb5jYdMP7zaSmc2wWcb1mkzNr6AR8o=
github.com/libp2p/go-libp2p-routing-helpers v0.7.1 h1:kc0kWCZecbBPAiFEHhxfGJZPqjg1g9zV+X+ovR4Tmnc=
github.com/libp2p/go-libp2p-routing-helpers v0.7.1/go.mod h1:cHStPSRC/wgbfpb5jYdMP7zaSmc2wWcb1mkzNr6AR8o=
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
github.com/libp2p/go-libp2p-xor v0.1.0 h1:hhQwT4uGrBcuAkUGXADuPltalOdpf9aag9kaYNT2tLA=
github.com/libp2p/go-libp2p-xor v0.1.0/go.mod h1:LSTM5yRnjGZbWNTA/hRwq2gGFrvRIbQJscoIL/u6InY=
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ require (
github.com/libp2p/go-libp2p-pubsub v0.9.3
github.com/libp2p/go-libp2p-pubsub-router v0.6.0
github.com/libp2p/go-libp2p-record v0.2.0
github.com/libp2p/go-libp2p-routing-helpers v0.7.1-0.20230724133210-850d18ac98d2
github.com/libp2p/go-libp2p-routing-helpers v0.7.1
github.com/libp2p/go-libp2p-testing v0.12.0
github.com/libp2p/go-socket-activation v0.1.0
github.com/mitchellh/go-homedir v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,8 @@ github.com/libp2p/go-libp2p-pubsub-router v0.6.0 h1:D30iKdlqDt5ZmLEYhHELCMRj8b4s
github.com/libp2p/go-libp2p-pubsub-router v0.6.0/go.mod h1:FY/q0/RBTKsLA7l4vqC2cbRbOvyDotg8PJQ7j8FDudE=
github.com/libp2p/go-libp2p-record v0.2.0 h1:oiNUOCWno2BFuxt3my4i1frNrt7PerzB3queqa1NkQ0=
github.com/libp2p/go-libp2p-record v0.2.0/go.mod h1:I+3zMkvvg5m2OcSdoL0KPljyJyvNDFGKX7QdlpYUcwk=
github.com/libp2p/go-libp2p-routing-helpers v0.7.1-0.20230724133210-850d18ac98d2 h1:vrpRNp4Op39bYYqPQjfwTU341Kckpmbp4QIvKitw37I=
github.com/libp2p/go-libp2p-routing-helpers v0.7.1-0.20230724133210-850d18ac98d2/go.mod h1:cHStPSRC/wgbfpb5jYdMP7zaSmc2wWcb1mkzNr6AR8o=
github.com/libp2p/go-libp2p-routing-helpers v0.7.1 h1:kc0kWCZecbBPAiFEHhxfGJZPqjg1g9zV+X+ovR4Tmnc=
github.com/libp2p/go-libp2p-routing-helpers v0.7.1/go.mod h1:cHStPSRC/wgbfpb5jYdMP7zaSmc2wWcb1mkzNr6AR8o=
github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg=
github.com/libp2p/go-libp2p-xor v0.1.0 h1:hhQwT4uGrBcuAkUGXADuPltalOdpf9aag9kaYNT2tLA=
Expand Down
10 changes: 5 additions & 5 deletions routing/delegated.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ func parse(visited map[string]bool,
}

pr = append(pr, &routinghelpers.ParallelRouter{
Router: ri,
IgnoreError: cr.IgnoreErrors,
DoNotWaitForStreamingResponses: cr.DoNotWaitForStreamingResponses,
Timeout: cr.Timeout.Duration,
ExecuteAfter: cr.ExecuteAfter.WithDefault(0),
Router: ri,
IgnoreError: cr.IgnoreErrors,
DoNotWaitForSearchValue: true,
Timeout: cr.Timeout.Duration,
ExecuteAfter: cr.ExecuteAfter.WithDefault(0),
})

}
Expand Down

0 comments on commit 77ecec5

Please sign in to comment.