Skip to content

Commit

Permalink
Update filter_system.go
Browse files Browse the repository at this point in the history
  • Loading branch information
CRossel87a committed May 9, 2023
1 parent ade0c1b commit f09d6bb
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion rpc/namespaces/ethereum/eth/filters/filter_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,22 @@ func (es EventSystem) SubscribePendingTxs() (*Subscription, pubsub.UnsubscribeFu

type filterIndex map[filters.Type]map[rpc.ID]*Subscription

/*
old:
case f := <-es.install:
es.indexMux.Lock()
es.index[f.typ][f.id] = f
ch := make(chan coretypes.ResultEvent)
es.topicChans[f.event] = ch
if err := es.eventBus.AddTopic(f.event, ch); err != nil {
es.logger.Error("failed to add event topic to event bus", "topic", f.event, "error", err.Error())
}
es.indexMux.Unlock()
close(f.installed)
*/

// eventLoop (un)installs filters and processes mux events.
func (es *EventSystem) eventLoop() {
for {
Expand All @@ -225,9 +241,10 @@ func (es *EventSystem) eventLoop() {
es.indexMux.Lock()
es.index[f.typ][f.id] = f
ch := make(chan coretypes.ResultEvent)
es.topicChans[f.event] = ch
if err := es.eventBus.AddTopic(f.event, ch); err != nil {
es.logger.Error("failed to add event topic to event bus", "topic", f.event, "error", err.Error())
} else {
es.topicChans[f.event] = ch
}
es.indexMux.Unlock()
close(f.installed)
Expand Down

0 comments on commit f09d6bb

Please sign in to comment.