Skip to content

Commit

Permalink
Merge pull request #80 from berty/dev/moul/quiet-log
Browse files Browse the repository at this point in the history
chore: decrease log verbosity for context canceled
  • Loading branch information
moul authored Oct 1, 2021
2 parents 5030118 + 37088ee commit c8ecbcc
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 9 deletions.
4 changes: 3 additions & 1 deletion baseorbitdb/orbitdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,9 @@ func (o *orbitDB) onNewPeerJoined(ctx context.Context, p p2pcore.PeerID, store S
_, err = o.exchangeHeads(ctx, p, store)

if err != nil {
o.logger.Error("unable to exchange heads", zap.Error(err))
if !errors.Is(err, context.Canceled) {
o.logger.Error("unable to exchange heads", zap.Error(err))
}
return
}

Expand Down
4 changes: 2 additions & 2 deletions iface/interface.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package iface

import (
"berty.tech/go-ipfs-log/enc"
"berty.tech/go-ipfs-log/iface"
"context"

ipfslog "berty.tech/go-ipfs-log"
"berty.tech/go-ipfs-log/enc"
"berty.tech/go-ipfs-log/identityprovider"
"berty.tech/go-ipfs-log/iface"
"berty.tech/go-ipfs-log/keystore"
"berty.tech/go-orbit-db/accesscontroller"
"berty.tech/go-orbit-db/address"
Expand Down
7 changes: 6 additions & 1 deletion pubsub/pubsubraw/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ func (p *psTopic) WatchPeers(ctx context.Context) (<-chan events.Event, error) {
for {
evt, err := ph.NextPeerEvent(ctx)
if err != nil {
p.ps.logger.Error("", zap.Error(err))
switch err {
case context.Canceled:
p.ps.logger.Debug("watch peers ended", zap.Error(err))
default:
p.ps.logger.Error("watch next peer event failed", zap.Error(err))
}
return
}

Expand Down
2 changes: 1 addition & 1 deletion tests/replicate_automatically_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package tests

import (
"berty.tech/go-orbit-db/events"
"context"
"fmt"
"strings"
Expand All @@ -10,6 +9,7 @@ import (

orbitdb "berty.tech/go-orbit-db"
"berty.tech/go-orbit-db/accesscontroller"
"berty.tech/go-orbit-db/events"
"berty.tech/go-orbit-db/iface"
"berty.tech/go-orbit-db/stores"
"berty.tech/go-orbit-db/stores/operation"
Expand Down
2 changes: 1 addition & 1 deletion tests/replicate_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package tests

import (
"berty.tech/go-ipfs-log/enc"
"context"
"fmt"
"os"
Expand All @@ -10,6 +9,7 @@ import (
"time"

ipfslog "berty.tech/go-ipfs-log"
"berty.tech/go-ipfs-log/enc"
orbitdb "berty.tech/go-orbit-db"
"berty.tech/go-orbit-db/accesscontroller"
"berty.tech/go-orbit-db/events"
Expand Down
7 changes: 4 additions & 3 deletions tests/testing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package tests

import (
"context"
"io/ioutil"
"os"
"testing"

"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/peerstore"
"io/ioutil"
"os"
"testing"

ipfsCore "github.com/ipfs/go-ipfs/core"
"github.com/ipfs/go-ipfs/core/coreapi"
Expand Down

0 comments on commit c8ecbcc

Please sign in to comment.