From 97e9fbec9d4d174e91f2048d28d696ecfd7f4d25 Mon Sep 17 00:00:00 2001 From: Dennis Trautwein Date: Thu, 28 Sep 2023 12:19:06 +0200 Subject: [PATCH] Incorporate PR feedback --- v2/internal/coord/coordinator.go | 4 +--- v2/routing.go | 2 +- v2/routing_test.go | 5 +++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/v2/internal/coord/coordinator.go b/v2/internal/coord/coordinator.go index 4623e880..cbaba85f 100644 --- a/v2/internal/coord/coordinator.go +++ b/v2/internal/coord/coordinator.go @@ -600,15 +600,13 @@ func (c *Coordinator) NotifyConnectivity(ctx context.Context, id kadt.PeerID) { // NotifyNonConnectivity notifies the coordinator that a peer has failed a connectivity check // which means it is not connected and/or it doesn't support finding closer nodes -func (c *Coordinator) NotifyNonConnectivity(ctx context.Context, id kadt.PeerID) error { +func (c *Coordinator) NotifyNonConnectivity(ctx context.Context, id kadt.PeerID) { ctx, span := c.tele.Tracer.Start(ctx, "Coordinator.NotifyNonConnectivity") defer span.End() c.routingBehaviour.Notify(ctx, &EventNotifyNonConnectivity{ NodeID: id, }) - - return nil } func (c *Coordinator) newOperationID() coordt.QueryID { diff --git a/v2/routing.go b/v2/routing.go index 6b2dc8ed..8227fbbb 100644 --- a/v2/routing.go +++ b/v2/routing.go @@ -438,7 +438,7 @@ func (d *DHT) searchValueRoutine(ctx context.Context, backend Backend, ns string _, _, err := d.kad.QueryMessage(ctx, req, fn, d.cfg.BucketSize) if err != nil { - d.log.Warn("Search value query failed", slog.String("err", err.Error())) + d.logErr(err, "Search value query failed") return } diff --git a/v2/routing_test.go b/v2/routing_test.go index 7e19352a..50d77895 100644 --- a/v2/routing_test.go +++ b/v2/routing_test.go @@ -340,7 +340,7 @@ LOOP: } func TestDHT_FindProvidersAsync_queries_other_peers(t *testing.T) { - ctx := context.Background() // kadtest.CtxShort(t) + ctx := kadtest.CtxShort(t) c := newRandomContent(t) @@ -599,8 +599,9 @@ func TestDHT_SearchValue_returns_best_values(t *testing.T) { // Test setup: // d2 returns no value // d3 returns valid value - // d4 returns worse value + // d4 returns worse value (will get rejected because we already have a valid value) // d5 returns better value + // all peers are connected in a chain from d1 to d5 (d1 initiates the query) // assert that we receive two values on the channel (valid + better) ctx := kadtest.CtxShort(t) clk := clock.New()