From 2005bf6b6775ab990b7be827b355ccbf04cafc7e Mon Sep 17 00:00:00 2001 From: maskpp Date: Sun, 19 Oct 2025 17:39:49 +0800 Subject: [PATCH] execute different subscription in parallel way --- eth/filters/filter_system.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/eth/filters/filter_system.go b/eth/filters/filter_system.go index 02783fa5ec..05476dd050 100644 --- a/eth/filters/filter_system.go +++ b/eth/filters/filter_system.go @@ -439,17 +439,21 @@ func (es *EventSystem) handleTxsEvent(filters filterIndex, ev core.NewTxsEvent) } func (es *EventSystem) handleChainEvent(filters filterIndex, ev core.ChainEvent) { - for _, f := range filters[BlocksSubscription] { - f.headers <- ev.Header - } - - // Handle transaction receipts subscriptions when a new block is added - for _, f := range filters[TransactionReceiptsSubscription] { - matchedReceipts := filterReceipts(f.txHashes, ev) - if len(matchedReceipts) > 0 { - f.receipts <- matchedReceipts + go func() { + for _, f := range filters[BlocksSubscription] { + f.headers <- ev.Header } - } + }() + + go func() { + // Handle transaction receipts subscriptions when a new block is added + for _, f := range filters[TransactionReceiptsSubscription] { + matchedReceipts := filterReceipts(f.txHashes, ev) + if len(matchedReceipts) > 0 { + f.receipts <- matchedReceipts + } + } + }() } // eventLoop (un)installs filters and processes mux events.