Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion p2p/host/eventbus/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

type logInterface interface {
Errorf(string, ...interface{})
Warnf(string, ...interface{})
}

var log logInterface = logging.Logger("eventbus")
Expand Down Expand Up @@ -464,7 +465,7 @@ func emitAndLogError(timer *time.Timer, typ reflect.Type, evt interface{}, sink
<-timer.C
}
case <-timer.C:
log.Errorf("subscriber named \"%s\" is a slow consumer of %s. This can lead to libp2p stalling and hard to debug issues.", sink.name, typ)
log.Warnf("subscriber named \"%s\" is a slow consumer of %s. This can lead to libp2p stalling and hard to debug issues.", sink.name, typ)
// Continue to stall since there's nothing else we can do.
sink.ch <- evt
}
Expand Down
10 changes: 8 additions & 2 deletions p2p/host/eventbus/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ import (
"github.com/stretchr/testify/require"
)

type EventA struct{}
type EventB int
type (
EventA struct{}
EventB int
)

func getN() int {
n := 50000
Expand Down Expand Up @@ -144,6 +146,10 @@ func (m *mockLogger) Errorf(format string, args ...interface{}) {
m.logs = append(m.logs, fmt.Sprintf(format, args...))
}

func (m *mockLogger) Warnf(format string, args ...interface{}) {
m.Errorf(format, args...)
}

func (m *mockLogger) Logs() []string {
m.mu.Lock()
defer m.mu.Unlock()
Expand Down