chore: stop light filter node by default (#964)

This commit is contained in:
kaichao 2023-12-21 08:44:51 +08:00 committed by GitHub
parent 5e3c9fdfa1
commit b4ba7b75d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 11 deletions

View File

@ -529,6 +529,7 @@ func (w *WakuNode) Stop() {
w.store.Stop()
w.legacyFilter.Stop()
w.filterFullNode.Stop()
w.filterLightNode.Stop()
if w.opts.enableDiscV5 {
w.discoveryV5.Stop()

View File

@ -112,6 +112,10 @@ func (wf *WakuFilterLightNode) Stop() {
wf.CommonService.Stop(func() {
wf.h.RemoveStreamHandler(FilterPushID_v20beta1)
if wf.subscriptions.Count() > 0 {
go func() {
defer func() {
_ = recover()
}()
res, err := wf.unsubscribeAll(wf.Context())
if err != nil {
wf.log.Warn("unsubscribing from full nodes", zap.Error(err))
@ -123,8 +127,8 @@ func (wf *WakuFilterLightNode) Stop() {
}
}
//
wf.subscriptions.Clear()
}()
}
})
}
@ -617,6 +621,7 @@ func (wf *WakuFilterLightNode) unsubscribeAll(ctx context.Context, opts ...Filte
if params.wg != nil {
params.wg.Done()
}
_ = recover()
}()
paramsCopy := params.Copy()