fix: exit relay loop on quit

This commit is contained in:
Richard Ramos 2022-11-11 10:34:56 -04:00 committed by RichΛrd
parent 6b11bc8b24
commit 2341dedfba
2 changed files with 14 additions and 8 deletions

View File

@ -862,7 +862,7 @@ func _1668109917_wakunodesUpSql() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "1668109917_wakunodes.up.sql", size: 97, mode: os.FileMode(0664), modTime: time.Unix(1668112286, 0)}
info := bindataFileInfo{name: "1668109917_wakunodes.up.sql", size: 97, mode: os.FileMode(0664), modTime: time.Unix(1668521192, 0)}
a := &asset{bytes: bytes, info: info, digest: [32]uint8{0x10, 0x62, 0xdb, 0x4e, 0xa2, 0x41, 0xe6, 0x97, 0x58, 0x5a, 0x90, 0xd9, 0x63, 0x1f, 0x9e, 0x18, 0x92, 0x2f, 0xb, 0x70, 0x7e, 0x6d, 0x73, 0x5b, 0x2b, 0xab, 0x4f, 0x64, 0x15, 0x60, 0x76, 0x74}}
return a, nil
}

View File

@ -469,14 +469,20 @@ func (w *Waku) runRelayMsgLoop() {
return
}
for env := range sub.C {
envelopeErrors, err := w.OnNewEnvelopes(env, common.RelayedMessageType)
if err != nil {
w.logger.Error("onNewEnvelope error", zap.Error(err))
for {
select {
case <-w.quit:
sub.Unsubscribe()
return
case env := <-sub.C:
envelopeErrors, err := w.OnNewEnvelopes(env, common.RelayedMessageType)
if err != nil {
w.logger.Error("onNewEnvelope error", zap.Error(err))
}
// TODO: should these be handled?
_ = envelopeErrors
_ = err
}
// TODO: should these be handled?
_ = envelopeErrors
_ = err
}
}