mirror of https://github.com/status-im/go-waku.git
chore: stop light filter node by default (#964)
This commit is contained in:
parent
5e3c9fdfa1
commit
b4ba7b75d4
|
@ -529,6 +529,7 @@ func (w *WakuNode) Stop() {
|
||||||
w.store.Stop()
|
w.store.Stop()
|
||||||
w.legacyFilter.Stop()
|
w.legacyFilter.Stop()
|
||||||
w.filterFullNode.Stop()
|
w.filterFullNode.Stop()
|
||||||
|
w.filterLightNode.Stop()
|
||||||
|
|
||||||
if w.opts.enableDiscV5 {
|
if w.opts.enableDiscV5 {
|
||||||
w.discoveryV5.Stop()
|
w.discoveryV5.Stop()
|
||||||
|
|
|
@ -112,19 +112,23 @@ func (wf *WakuFilterLightNode) Stop() {
|
||||||
wf.CommonService.Stop(func() {
|
wf.CommonService.Stop(func() {
|
||||||
wf.h.RemoveStreamHandler(FilterPushID_v20beta1)
|
wf.h.RemoveStreamHandler(FilterPushID_v20beta1)
|
||||||
if wf.subscriptions.Count() > 0 {
|
if wf.subscriptions.Count() > 0 {
|
||||||
res, err := wf.unsubscribeAll(wf.Context())
|
go func() {
|
||||||
if err != nil {
|
defer func() {
|
||||||
wf.log.Warn("unsubscribing from full nodes", zap.Error(err))
|
_ = recover()
|
||||||
}
|
}()
|
||||||
|
res, err := wf.unsubscribeAll(wf.Context())
|
||||||
for _, r := range res.Errors() {
|
if err != nil {
|
||||||
if r.Err != nil {
|
wf.log.Warn("unsubscribing from full nodes", zap.Error(err))
|
||||||
wf.log.Warn("unsubscribing from full nodes", zap.Error(r.Err), logging.HostID("peerID", r.PeerID))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
for _, r := range res.Errors() {
|
||||||
//
|
if r.Err != nil {
|
||||||
wf.subscriptions.Clear()
|
wf.log.Warn("unsubscribing from full nodes", zap.Error(r.Err), logging.HostID("peerID", r.PeerID))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
wf.subscriptions.Clear()
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -617,6 +621,7 @@ func (wf *WakuFilterLightNode) unsubscribeAll(ctx context.Context, opts ...Filte
|
||||||
if params.wg != nil {
|
if params.wg != nil {
|
||||||
params.wg.Done()
|
params.wg.Done()
|
||||||
}
|
}
|
||||||
|
_ = recover()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
paramsCopy := params.Copy()
|
paramsCopy := params.Copy()
|
||||||
|
|
Loading…
Reference in New Issue