Skip to content

Commit bd9f98f

Browse files
committed
chore_: skip message verification if using expensive connection
1 parent 45adfea commit bd9f98f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Diff for: wakuv2/missing_messages.go

+5
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ func (w *Waku) checkForMissingMessages() {
105105
for {
106106
select {
107107
case <-t.C:
108+
if w.IsConnExpensive {
109+
w.logger.Debug("skipping missing message verification due to using expensive connection")
110+
continue
111+
}
112+
108113
w.logger.Debug("checking for missing messages...")
109114
w.topicInterestMu.Lock()
110115
for _, request := range w.topicInterest {

Diff for: wakuv2/waku.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ type Waku struct {
161161
connectionNotifChan chan node.PeerConnection
162162
connStatusSubscriptions map[string]*types.ConnStatusSubscription
163163
connStatusMu sync.Mutex
164+
IsConnExpensive bool
164165
onlineChecker *onlinechecker.DefaultOnlineChecker
165166

166167
logger *zap.Logger
@@ -1415,7 +1416,8 @@ func (w *Waku) Start() error {
14151416
}
14161417

14171418
w.ConnectionChanged(connection.State{
1418-
Offline: !latestConnStatus.IsOnline,
1419+
Offline: !latestConnStatus.IsOnline,
1420+
Expensive: w.IsConnExpensive,
14191421
})
14201422
}
14211423
}
@@ -1809,6 +1811,8 @@ func (w *Waku) ConnectionChanged(state connection.State) {
18091811
}
18101812

18111813
w.onlineChecker.SetOnline(!state.Offline)
1814+
1815+
w.IsConnExpensive = state.Expensive
18121816
}
18131817

18141818
// seedBootnodesForDiscV5 tries to fetch bootnodes

0 commit comments

Comments
 (0)