From 5197bf8ebfc192639e9c51bfeebcab9554e7b249 Mon Sep 17 00:00:00 2001 From: Fred Carle Date: Fri, 31 May 2024 00:38:49 -0400 Subject: [PATCH] fix lint --- internal/db/merge.go | 3 ++- net/node.go | 32 ++++++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/internal/db/merge.go b/internal/db/merge.go index 9fb7374c16..f35a3269dd 100644 --- a/internal/db/merge.go +++ b/internal/db/merge.go @@ -19,6 +19,8 @@ import ( cidlink "github.com/ipld/go-ipld-prime/linking/cid" "github.com/sourcenetwork/corelog" + "github.com/sourcenetwork/immutable" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/datastore" "github.com/sourcenetwork/defradb/errors" @@ -28,7 +30,6 @@ import ( "github.com/sourcenetwork/defradb/internal/db/base" "github.com/sourcenetwork/defradb/internal/merkle/clock" merklecrdt "github.com/sourcenetwork/defradb/internal/merkle/crdt" - "github.com/sourcenetwork/immutable" ) func (db *db) handleMerges(ctx context.Context, merges events.Subscription[events.DAGMerge]) { diff --git a/net/node.go b/net/node.go index 7b403720e6..e8ac0f1348 100644 --- a/net/node.go +++ b/net/node.go @@ -277,7 +277,14 @@ func (n *Node) subscribeToPeerConnectionEvents() { for { select { case <-n.ctx.Done(): - sub.Close() + err := sub.Close() + if err != nil { + log.ErrorContextE( + n.ctx, + "Failed to close peer connectedness changed event subscription", + err, + ) + } return case e, ok := <-sub.Out(): if !ok { @@ -308,7 +315,14 @@ func (n *Node) subscribeToPubSubEvents() { for { select { case <-n.ctx.Done(): - sub.Close() + err := sub.Close() + if err != nil { + log.ErrorContextE( + n.ctx, + "Failed to close pubsub event subscription", + err, + ) + } return case e, ok := <-sub.Out(): if !ok { @@ -339,7 +353,14 @@ func (n *Node) subscribeToPushLogEvents() { for { select { case <-n.ctx.Done(): - sub.Close() + err := sub.Close() + if err != nil { + log.ErrorContextE( + n.ctx, + "Failed to close push log event subscription", + err, + ) + } return case e, ok := <-sub.Out(): if !ok { @@ -462,7 +483,10 @@ func (n Node) Close() { n.Peer.Close() } if n.dhtClose != nil { - n.dhtClose() + err := n.dhtClose() + if err != nil { + log.ErrorContextE(n.ctx, "Failed to close DHT", err) + } } n.DB.Close() }